home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1990-04-27 | 48.0 KB | [TEXT/MPS ] |
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary).
Confidence | Program | Detection | Match Type | Support
|
---|
66%
| dexvert
| Compact Compressed (Unix) (archive/compact)
| ext
| Supported |
10%
| dexvert
| MacBinary (archive/macBinary)
| fallback
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| MacBinary II, Fri Apr 27 14:05:50 1990, modified Fri Apr 27 14:05:50 1990, creator 'MPS ', type ASCII, 48565 bytes "fold-const.c" , at 0xbe35 382 bytes resource
| default (weak)
| |
99%
| file
| data
| default
| |
74%
| TrID
| Macintosh plain text (MacBinary)
| default
| |
25%
| TrID
| MacBinary 2
| default (weak)
| |
100%
| siegfried
| fmt/1762 MacBinary (II)
| default
| |
100%
| lsar
| MacBinary
| default
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [MPS ] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0c 66 6f 6c 64 2d 63 | 6f 6e 73 74 2e 63 00 00 |..fold-c|onst.c..|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 00 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 bd b5 00 | 00 01 7e a2 5e 3a 7e a2 |........|..~.^:~.|
|00000060| 5e 3a 7e 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |^:~.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 54 f1 00 00 |........|....T...|
|00000080| 2f 2a 20 46 6f 6c 64 20 | 61 20 63 6f 6e 73 74 61 |/* Fold |a consta|
|00000090| 6e 74 20 73 75 62 2d 74 | 72 65 65 20 69 6e 74 6f |nt sub-t|ree into|
|000000a0| 20 61 20 73 69 6e 67 6c | 65 20 6e 6f 64 65 20 66 | a singl|e node f|
|000000b0| 6f 72 20 43 2d 63 6f 6d | 70 69 6c 65 72 0d 20 20 |or C-com|piler. |
|000000c0| 20 43 6f 70 79 72 69 67 | 68 74 20 28 43 29 20 31 | Copyrig|ht (C) 1|
|000000d0| 39 38 37 2c 20 31 39 38 | 38 20 46 72 65 65 20 53 |987, 198|8 Free S|
|000000e0| 6f 66 74 77 61 72 65 20 | 46 6f 75 6e 64 61 74 69 |oftware |Foundati|
|000000f0| 6f 6e 2c 20 49 6e 63 2e | 0d 20 20 20 43 6f 70 79 |on, Inc.|. Copy|
|00000100| 72 69 67 68 74 20 28 43 | 29 20 31 39 38 39 2c 20 |right (C|) 1989, |
|00000110| 31 39 39 30 20 41 70 70 | 6c 65 20 43 6f 6d 70 75 |1990 App|le Compu|
|00000120| 74 65 72 2c 20 49 6e 63 | 2e 0d 0d 54 68 69 73 20 |ter, Inc|...This |
|00000130| 66 69 6c 65 20 69 73 20 | 70 61 72 74 20 6f 66 20 |file is |part of |
|00000140| 47 4e 55 20 43 43 2e 0d | 0d 47 4e 55 20 43 43 20 |GNU CC..|.GNU CC |
|00000150| 69 73 20 66 72 65 65 20 | 73 6f 66 74 77 61 72 65 |is free |software|
|00000160| 3b 20 79 6f 75 20 63 61 | 6e 20 72 65 64 69 73 74 |; you ca|n redist|
|00000170| 72 69 62 75 74 65 20 69 | 74 20 61 6e 64 2f 6f 72 |ribute i|t and/or|
|00000180| 20 6d 6f 64 69 66 79 0d | 69 74 20 75 6e 64 65 72 | modify.|it under|
|00000190| 20 74 68 65 20 74 65 72 | 6d 73 20 6f 66 20 74 68 | the ter|ms of th|
|000001a0| 65 20 47 4e 55 20 47 65 | 6e 65 72 61 6c 20 50 75 |e GNU Ge|neral Pu|
|000001b0| 62 6c 69 63 20 4c 69 63 | 65 6e 73 65 20 61 73 20 |blic Lic|ense as |
|000001c0| 70 75 62 6c 69 73 68 65 | 64 20 62 79 0d 74 68 65 |publishe|d by.the|
|000001d0| 20 46 72 65 65 20 53 6f | 66 74 77 61 72 65 20 46 | Free So|ftware F|
|000001e0| 6f 75 6e 64 61 74 69 6f | 6e 3b 20 65 69 74 68 65 |oundatio|n; eithe|
|000001f0| 72 20 76 65 72 73 69 6f | 6e 20 31 2c 20 6f 72 20 |r versio|n 1, or |
|00000200| 28 61 74 20 79 6f 75 72 | 20 6f 70 74 69 6f 6e 29 |(at your| option)|
|00000210| 0d 61 6e 79 20 6c 61 74 | 65 72 20 76 65 72 73 69 |.any lat|er versi|
|00000220| 6f 6e 2e 0d 0d 47 4e 55 | 20 43 43 20 69 73 20 64 |on...GNU| CC is d|
|00000230| 69 73 74 72 69 62 75 74 | 65 64 20 69 6e 20 74 68 |istribut|ed in th|
|00000240| 65 20 68 6f 70 65 20 74 | 68 61 74 20 69 74 20 77 |e hope t|hat it w|
|00000250| 69 6c 6c 20 62 65 20 75 | 73 65 66 75 6c 2c 0d 62 |ill be u|seful,.b|
|00000260| 75 74 20 57 49 54 48 4f | 55 54 20 41 4e 59 20 57 |ut WITHO|UT ANY W|
|00000270| 41 52 52 41 4e 54 59 3b | 20 77 69 74 68 6f 75 74 |ARRANTY;| without|
|00000280| 20 65 76 65 6e 20 74 68 | 65 20 69 6d 70 6c 69 65 | even th|e implie|
|00000290| 64 20 77 61 72 72 61 6e | 74 79 20 6f 66 0d 4d 45 |d warran|ty of.ME|
|000002a0| 52 43 48 41 4e 54 41 42 | 49 4c 49 54 59 20 6f 72 |RCHANTAB|ILITY or|
|000002b0| 20 46 49 54 4e 45 53 53 | 20 46 4f 52 20 41 20 50 | FITNESS| FOR A P|
|000002c0| 41 52 54 49 43 55 4c 41 | 52 20 50 55 52 50 4f 53 |ARTICULA|R PURPOS|
|000002d0| 45 2e 20 20 53 65 65 20 | 74 68 65 0d 47 4e 55 20 |E. See |the.GNU |
|000002e0| 47 65 6e 65 72 61 6c 20 | 50 75 62 6c 69 63 20 4c |General |Public L|
|000002f0| 69 63 65 6e 73 65 20 66 | 6f 72 20 6d 6f 72 65 20 |icense f|or more |
|00000300| 64 65 74 61 69 6c 73 2e | 0d 0d 59 6f 75 20 73 68 |details.|..You sh|
|00000310| 6f 75 6c 64 20 68 61 76 | 65 20 72 65 63 65 69 76 |ould hav|e receiv|
|00000320| 65 64 20 61 20 63 6f 70 | 79 20 6f 66 20 74 68 65 |ed a cop|y of the|
|00000330| 20 47 4e 55 20 47 65 6e | 65 72 61 6c 20 50 75 62 | GNU Gen|eral Pub|
|00000340| 6c 69 63 20 4c 69 63 65 | 6e 73 65 0d 61 6c 6f 6e |lic Lice|nse.alon|
|00000350| 67 20 77 69 74 68 20 47 | 4e 55 20 43 43 3b 20 73 |g with G|NU CC; s|
|00000360| 65 65 20 74 68 65 20 66 | 69 6c 65 20 43 4f 50 59 |ee the f|ile COPY|
|00000370| 49 4e 47 2e 20 20 49 66 | 20 6e 6f 74 2c 20 77 72 |ING. If| not, wr|
|00000380| 69 74 65 20 74 6f 0d 74 | 68 65 20 46 72 65 65 20 |ite to.t|he Free |
|00000390| 53 6f 66 74 77 61 72 65 | 20 46 6f 75 6e 64 61 74 |Software| Foundat|
|000003a0| 69 6f 6e 2c 20 36 37 35 | 20 4d 61 73 73 20 41 76 |ion, 675| Mass Av|
|000003b0| 65 2c 20 43 61 6d 62 72 | 69 64 67 65 2c 20 4d 41 |e, Cambr|idge, MA|
|000003c0| 20 30 32 31 33 39 2c 20 | 55 53 41 2e 20 20 2a 2f | 02139, |USA. */|
|000003d0| 0d 0d 2f 2a 40 40 20 46 | 69 78 20 6c 6f 73 73 61 |../*@@ F|ix lossa|
|000003e0| 67 65 20 6f 6e 20 66 6f | 6c 64 69 6e 67 20 64 69 |ge on fo|lding di|
|000003f0| 76 69 73 69 6f 6e 20 6f | 66 20 62 69 67 20 69 6e |vision o|f big in|
|00000400| 74 65 67 65 72 73 2e 20 | 20 2a 2f 0d 0d 2f 2a 40 |tegers. | */../*@|
|00000410| 40 20 54 68 69 73 20 66 | 69 6c 65 20 73 68 6f 75 |@ This f|ile shou|
|00000420| 6c 64 20 62 65 20 72 65 | 77 72 69 74 74 65 6e 20 |ld be re|written |
|00000430| 74 6f 20 75 73 65 20 61 | 6e 20 61 72 62 69 74 61 |to use a|n arbita|
|00000440| 72 79 20 70 72 65 63 69 | 73 69 6f 6e 0d 20 20 40 |ry preci|sion. @|
|00000450| 40 20 72 65 70 72 65 73 | 65 6e 74 61 74 69 6f 6e |@ repres|entation|
|00000460| 20 66 6f 72 20 22 73 74 | 72 75 63 74 20 74 72 65 | for "st|ruct tre|
|00000470| 65 5f 69 6e 74 5f 63 73 | 74 22 20 61 6e 64 20 22 |e_int_cs|t" and "|
|00000480| 73 74 72 75 63 74 20 74 | 72 65 65 5f 72 65 61 6c |struct t|ree_real|
|00000490| 5f 63 73 74 22 2e 0d 20 | 20 40 40 20 50 65 72 68 |_cst".. | @@ Perh|
|000004a0| 61 70 73 20 74 68 65 20 | 72 6f 75 74 69 6e 65 73 |aps the |routines|
|000004b0| 20 63 6f 75 6c 64 20 61 | 6c 73 6f 20 62 65 20 75 | could a|lso be u|
|000004c0| 73 65 64 20 66 6f 72 20 | 62 63 2f 64 63 2c 20 61 |sed for |bc/dc, a|
|000004d0| 6e 64 20 6d 61 64 65 20 | 61 20 6c 69 62 2e 0d 20 |nd made |a lib.. |
|000004e0| 20 40 40 20 54 68 65 20 | 72 6f 75 74 69 6e 65 73 | @@ The |routines|
|000004f0| 20 74 68 61 74 20 74 72 | 61 6e 73 6c 61 74 65 20 | that tr|anslate |
|00000500| 66 72 6f 6d 20 74 68 65 | 20 61 70 20 72 65 70 20 |from the| ap rep |
|00000510| 73 68 6f 75 6c 64 0d 20 | 20 40 40 20 77 61 72 6e |should. | @@ warn|
|00000520| 20 69 66 20 70 72 65 63 | 69 73 69 6f 6e 20 65 74 | if prec|ision et|
|00000530| 2e 20 61 6c 2e 20 69 73 | 20 6c 6f 73 74 2e 0d 20 |. al. is| lost.. |
|00000540| 20 40 40 20 54 68 69 73 | 20 77 6f 75 6c 64 20 61 | @@ This| would a|
|00000550| 6c 73 6f 20 6d 61 6b 65 | 20 6c 69 66 65 20 65 61 |lso make| life ea|
|00000560| 73 69 65 72 20 77 68 65 | 6e 20 74 68 69 73 20 74 |sier whe|n this t|
|00000570| 65 63 68 6e 6f 6c 6f 67 | 79 20 69 73 20 75 73 65 |echnolog|y is use|
|00000580| 64 0d 20 20 40 40 20 66 | 6f 72 20 63 72 6f 73 73 |d. @@ f|or cross|
|00000590| 2d 63 6f 6d 70 69 6c 65 | 72 73 2e 20 20 2a 2f 0d |-compile|rs. */.|
|000005a0| 0d 0d 2f 2a 20 54 68 65 | 72 65 20 61 72 65 20 6f |../* The|re are o|
|000005b0| 6e 6c 79 20 74 77 6f 20 | 65 6e 74 72 79 20 70 6f |nly two |entry po|
|000005c0| 69 6e 74 73 20 69 6e 20 | 74 68 69 73 20 66 69 6c |ints in |this fil|
|000005d0| 65 3a 0d 20 20 20 66 6f | 6c 64 20 61 6e 64 20 63 |e:. fo|ld and c|
|000005e0| 6f 6d 62 69 6e 65 2e 0d | 0d 20 20 20 66 6f 6c 64 |ombine..|. fold|
|000005f0| 20 74 61 6b 65 73 20 61 | 20 74 72 65 65 20 61 73 | takes a| tree as|
|00000600| 20 61 72 67 75 6d 65 6e | 74 20 61 6e 64 20 72 65 | argumen|t and re|
|00000610| 74 75 72 6e 73 20 61 20 | 73 69 6d 70 6c 69 66 69 |turns a |simplifi|
|00000620| 65 64 20 74 72 65 65 2e | 0d 0d 20 20 20 63 6f 6d |ed tree.|.. com|
|00000630| 62 69 6e 65 20 74 61 6b | 65 73 20 61 20 74 72 65 |bine tak|es a tre|
|00000640| 65 20 63 6f 64 65 20 66 | 6f 72 20 61 6e 20 61 72 |e code f|or an ar|
|00000650| 69 74 68 6d 65 74 69 63 | 20 6f 70 65 72 61 74 69 |ithmetic| operati|
|00000660| 6f 6e 0d 20 20 20 61 6e | 64 20 74 77 6f 20 6f 70 |on. an|d two op|
|00000670| 65 72 61 6e 64 73 20 74 | 68 61 74 20 61 72 65 20 |erands t|hat are |
|00000680| 74 72 65 65 73 20 66 6f | 72 20 63 6f 6e 73 74 61 |trees fo|r consta|
|00000690| 6e 74 20 76 61 6c 75 65 | 73 0d 20 20 20 61 6e 64 |nt value|s. and|
|000006a0| 20 72 65 74 75 72 6e 73 | 20 74 68 65 20 72 65 73 | returns| the res|
|000006b0| 75 6c 74 20 6f 66 20 74 | 68 65 20 73 70 65 63 69 |ult of t|he speci|
|000006c0| 66 69 65 64 20 6f 70 65 | 72 61 74 69 6f 6e 20 6f |fied ope|ration o|
|000006d0| 6e 20 74 68 6f 73 65 20 | 76 61 6c 75 65 73 2c 0d |n those |values,.|
|000006e0| 20 20 20 61 6c 73 6f 20 | 61 73 20 61 20 74 72 65 | also |as a tre|
|000006f0| 65 2e 20 20 2a 2f 0d 20 | 20 20 0d 23 69 6e 63 6c |e. */. | .#incl|
|00000700| 75 64 65 20 3c 73 74 64 | 69 6f 2e 68 3e 0d 23 69 |ude <std|io.h>.#i|
|00000710| 6e 63 6c 75 64 65 20 3c | 73 65 74 6a 6d 70 2e 68 |nclude <|setjmp.h|
|00000720| 3e 0d 23 69 6e 63 6c 75 | 64 65 20 22 63 6f 6e 66 |>.#inclu|de "conf|
|00000730| 69 67 2e 68 22 0d 23 69 | 6e 63 6c 75 64 65 20 22 |ig.h".#i|nclude "|
|00000740| 74 72 65 65 2e 68 22 0d | 0d 73 74 61 74 69 63 20 |tree.h".|.static |
|00000750| 76 6f 69 64 20 6c 73 68 | 69 66 74 5f 64 6f 75 62 |void lsh|ift_doub|
|00000760| 6c 65 20 28 29 3b 0d 73 | 74 61 74 69 63 20 76 6f |le ();.s|tatic vo|
|00000770| 69 64 20 72 73 68 69 66 | 74 5f 64 6f 75 62 6c 65 |id rshif|t_double|
|00000780| 20 28 29 3b 0d 73 74 61 | 74 69 63 20 76 6f 69 64 | ();.sta|tic void|
|00000790| 20 6c 72 6f 74 61 74 65 | 5f 64 6f 75 62 6c 65 20 | lrotate|_double |
|000007a0| 28 29 3b 0d 73 74 61 74 | 69 63 20 76 6f 69 64 20 |();.stat|ic void |
|000007b0| 72 72 6f 74 61 74 65 5f | 64 6f 75 62 6c 65 20 28 |rrotate_|double (|
|000007c0| 29 3b 0d 0c 0d 2f 2a 20 | 54 6f 20 64 6f 20 63 6f |);.../* |To do co|
|000007d0| 6e 73 74 61 6e 74 20 66 | 6f 6c 64 69 6e 67 20 6f |nstant f|olding o|
|000007e0| 6e 20 49 4e 54 45 47 45 | 52 5f 43 53 54 20 6e 6f |n INTEGE|R_CST no|
|000007f0| 64 65 73 20 72 65 71 75 | 69 72 65 73 20 36 34 2d |des requ|ires 64-|
|00000800| 62 69 74 20 61 72 69 74 | 68 6d 65 74 69 63 2e 0d |bit arit|hmetic..|
|00000810| 20 20 20 57 65 20 64 6f | 20 74 68 61 74 20 62 79 | We do| that by|
|00000820| 20 72 65 70 72 65 73 65 | 6e 74 69 6e 67 20 74 68 | represe|nting th|
|00000830| 65 20 36 34 2d 62 69 74 | 20 69 6e 74 65 67 65 72 |e 64-bit| integer|
|00000840| 20 61 73 20 38 20 73 68 | 6f 72 74 73 2c 0d 20 20 | as 8 sh|orts,. |
|00000850| 20 77 69 74 68 20 6f 6e | 6c 79 20 38 20 62 69 74 | with on|ly 8 bit|
|00000860| 73 20 73 74 6f 72 65 64 | 20 69 6e 20 65 61 63 68 |s stored| in each|
|00000870| 20 73 68 6f 72 74 2c 20 | 61 73 20 61 20 70 6f 73 | short, |as a pos|
|00000880| 69 74 69 76 65 20 6e 75 | 6d 62 65 72 2e 20 20 2a |itive nu|mber. *|
|00000890| 2f 0d 0d 2f 2a 20 55 6e | 70 61 63 6b 20 61 20 36 |/../* Un|pack a 6|
|000008a0| 34 2d 62 69 74 20 69 6e | 74 65 67 65 72 20 69 6e |4-bit in|teger in|
|000008b0| 74 6f 20 38 20 73 68 6f | 72 74 73 2e 0d 20 20 20 |to 8 sho|rts.. |
|000008c0| 4c 4f 57 20 61 6e 64 20 | 48 49 20 61 72 65 20 74 |LOW and |HI are t|
|000008d0| 68 65 20 69 6e 74 65 67 | 65 72 2c 20 61 73 20 74 |he integ|er, as t|
|000008e0| 77 6f 20 60 69 6e 74 27 | 20 70 69 65 63 65 73 2e |wo `int'| pieces.|
|000008f0| 0d 20 20 20 53 48 4f 52 | 54 53 20 70 6f 69 6e 74 |. SHOR|TS point|
|00000900| 73 20 74 6f 20 74 68 65 | 20 61 72 72 61 79 20 6f |s to the| array o|
|00000910| 66 20 73 68 6f 72 74 73 | 2e 20 20 2a 2f 0d 0d 73 |f shorts|. */..s|
|00000920| 74 61 74 69 63 20 76 6f | 69 64 0d 65 6e 63 6f 64 |tatic vo|id.encod|
|00000930| 65 20 28 73 68 6f 72 74 | 73 2c 20 6c 6f 77 2c 20 |e (short|s, low, |
|00000940| 68 69 29 0d 20 20 20 20 | 20 73 68 6f 72 74 20 2a |hi). | short *|
|00000950| 73 68 6f 72 74 73 3b 0d | 20 20 20 20 20 69 6e 74 |shorts;.| int|
|00000960| 20 6c 6f 77 2c 20 68 69 | 3b 0d 7b 0d 20 20 73 68 | low, hi|;.{. sh|
|00000970| 6f 72 74 73 5b 30 5d 20 | 3d 20 6c 6f 77 20 26 20 |orts[0] |= low & |
|00000980| 30 78 66 66 3b 0d 20 20 | 73 68 6f 72 74 73 5b 31 |0xff;. |shorts[1|
|00000990| 5d 20 3d 20 28 6c 6f 77 | 20 3e 3e 20 38 29 20 26 |] = (low| >> 8) &|
|000009a0| 20 30 78 66 66 3b 0d 20 | 20 73 68 6f 72 74 73 5b | 0xff;. | shorts[|
|000009b0| 32 5d 20 3d 20 28 6c 6f | 77 20 3e 3e 20 31 36 29 |2] = (lo|w >> 16)|
|000009c0| 20 26 20 30 78 66 66 3b | 0d 20 20 73 68 6f 72 74 | & 0xff;|. short|
|000009d0| 73 5b 33 5d 20 3d 20 28 | 6c 6f 77 20 3e 3e 20 32 |s[3] = (|low >> 2|
|000009e0| 34 29 20 26 20 30 78 66 | 66 3b 0d 20 20 73 68 6f |4) & 0xf|f;. sho|
|000009f0| 72 74 73 5b 34 5d 20 3d | 20 68 69 20 26 20 30 78 |rts[4] =| hi & 0x|
|00000a00| 66 66 3b 0d 20 20 73 68 | 6f 72 74 73 5b 35 5d 20 |ff;. sh|orts[5] |
|00000a10| 3d 20 28 68 69 20 3e 3e | 20 38 29 20 26 20 30 78 |= (hi >>| 8) & 0x|
|00000a20| 66 66 3b 0d 20 20 73 68 | 6f 72 74 73 5b 36 5d 20 |ff;. sh|orts[6] |
|00000a30| 3d 20 28 68 69 20 3e 3e | 20 31 36 29 20 26 20 30 |= (hi >>| 16) & 0|
|00000a40| 78 66 66 3b 0d 20 20 73 | 68 6f 72 74 73 5b 37 5d |xff;. s|horts[7]|
|00000a50| 20 3d 20 28 68 69 20 3e | 3e 20 32 34 29 20 26 20 | = (hi >|> 24) & |
|00000a60| 30 78 66 66 3b 0d 7d 0d | 0d 2f 2a 20 50 61 63 6b |0xff;.}.|./* Pack|
|00000a70| 20 61 6e 20 61 72 72 61 | 79 20 6f 66 20 38 20 73 | an arra|y of 8 s|
|00000a80| 68 6f 72 74 73 20 69 6e | 74 6f 20 61 20 36 34 2d |horts in|to a 64-|
|00000a90| 62 69 74 20 69 6e 74 65 | 67 65 72 2e 0d 20 20 20 |bit inte|ger.. |
|00000aa0| 53 48 4f 52 54 53 20 70 | 6f 69 6e 74 73 20 74 6f |SHORTS p|oints to|
|00000ab0| 20 74 68 65 20 61 72 72 | 61 79 20 6f 66 20 73 68 | the arr|ay of sh|
|00000ac0| 6f 72 74 73 2e 0d 20 20 | 20 54 68 65 20 69 6e 74 |orts.. | The int|
|00000ad0| 65 67 65 72 20 69 73 20 | 73 74 6f 72 65 64 20 69 |eger is |stored i|
|00000ae0| 6e 74 6f 20 2a 4c 4f 57 | 20 61 6e 64 20 2a 48 49 |nto *LOW| and *HI|
|00000af0| 20 61 73 20 74 77 6f 20 | 60 69 6e 74 27 20 70 69 | as two |`int' pi|
|00000b00| 65 63 65 73 2e 20 20 2a | 2f 0d 0d 73 74 61 74 69 |eces. *|/..stati|
|00000b10| 63 20 76 6f 69 64 0d 64 | 65 63 6f 64 65 20 28 73 |c void.d|ecode (s|
|00000b20| 68 6f 72 74 73 2c 20 6c | 6f 77 2c 20 68 69 29 0d |horts, l|ow, hi).|
|00000b30| 20 20 20 20 20 73 68 6f | 72 74 20 2a 73 68 6f 72 | sho|rt *shor|
|00000b40| 74 73 3b 0d 20 20 20 20 | 20 69 6e 74 20 2a 6c 6f |ts;. | int *lo|
|00000b50| 77 2c 20 2a 68 69 3b 0d | 7b 0d 20 20 2a 6c 6f 77 |w, *hi;.|{. *low|
|00000b60| 20 3d 20 28 73 68 6f 72 | 74 73 5b 33 5d 20 3c 3c | = (shor|ts[3] <<|
|00000b70| 20 32 34 29 20 7c 20 28 | 73 68 6f 72 74 73 5b 32 | 24) | (|shorts[2|
|00000b80| 5d 20 3c 3c 20 31 36 29 | 20 7c 20 28 73 68 6f 72 |] << 16)| | (shor|
|00000b90| 74 73 5b 31 5d 20 3c 3c | 20 38 29 20 7c 20 73 68 |ts[1] <<| 8) | sh|
|00000ba0| 6f 72 74 73 5b 30 5d 3b | 0d 20 20 2a 68 69 20 3d |orts[0];|. *hi =|
|00000bb0| 20 28 73 68 6f 72 74 73 | 5b 37 5d 20 3c 3c 20 32 | (shorts|[7] << 2|
|00000bc0| 34 29 20 7c 20 28 73 68 | 6f 72 74 73 5b 36 5d 20 |4) | (sh|orts[6] |
|00000bd0| 3c 3c 20 31 36 29 20 7c | 20 28 73 68 6f 72 74 73 |<< 16) || (shorts|
|00000be0| 5b 35 5d 20 3c 3c 20 38 | 29 20 7c 20 73 68 6f 72 |[5] << 8|) | shor|
|00000bf0| 74 73 5b 34 5d 3b 0d 7d | 0d 0c 0d 2f 2a 20 4d 61 |ts[4];.}|.../* Ma|
|00000c00| 6b 65 20 74 68 65 20 69 | 6e 74 65 67 65 72 20 63 |ke the i|nteger c|
|00000c10| 6f 6e 73 74 61 6e 74 20 | 54 20 76 61 6c 69 64 20 |onstant |T valid |
|00000c20| 66 6f 72 20 69 74 73 20 | 74 79 70 65 0d 20 20 20 |for its |type. |
|00000c30| 62 79 20 73 65 74 74 69 | 6e 67 20 74 6f 20 30 20 |by setti|ng to 0 |
|00000c40| 6f 72 20 31 20 61 6c 6c | 20 74 68 65 20 62 69 74 |or 1 all| the bit|
|00000c50| 73 20 69 6e 20 74 68 65 | 20 63 6f 6e 73 74 61 6e |s in the| constan|
|00000c60| 74 0d 20 20 20 74 68 61 | 74 20 64 6f 6e 27 74 20 |t. tha|t don't |
|00000c70| 62 65 6c 6f 6e 67 20 69 | 6e 20 74 68 65 20 74 79 |belong i|n the ty|
|00000c80| 70 65 2e 20 20 2a 2f 0d | 0d 73 74 61 74 69 63 20 |pe. */.|.static |
|00000c90| 76 6f 69 64 0d 66 6f 72 | 63 65 5f 66 69 74 5f 74 |void.for|ce_fit_t|
|00000ca0| 79 70 65 20 28 74 29 0d | 20 20 20 20 20 74 72 65 |ype (t).| tre|
|00000cb0| 65 20 74 3b 0d 7b 0d 20 | 20 72 65 67 69 73 74 65 |e t;.{. | registe|
|00000cc0| 72 20 69 6e 74 20 70 72 | 65 63 20 3d 20 54 59 50 |r int pr|ec = TYP|
|00000cd0| 45 5f 50 52 45 43 49 53 | 49 4f 4e 20 28 54 52 45 |E_PRECIS|ION (TRE|
|00000ce0| 45 5f 54 59 50 45 20 28 | 74 29 29 3b 0d 0d 20 20 |E_TYPE (|t));.. |
|00000cf0| 69 66 20 28 54 52 45 45 | 5f 43 4f 44 45 20 28 54 |if (TREE|_CODE (T|
|00000d00| 52 45 45 5f 54 59 50 45 | 20 28 74 29 29 20 3d 3d |REE_TYPE| (t)) ==|
|00000d10| 20 50 4f 49 4e 54 45 52 | 5f 54 59 50 45 29 0d 20 | POINTER|_TYPE). |
|00000d20| 20 20 20 70 72 65 63 20 | 3d 20 42 49 54 53 5f 50 | prec |= BITS_P|
|00000d30| 45 52 5f 57 4f 52 44 3b | 0d 0d 20 20 2f 2a 20 46 |ER_WORD;|.. /* F|
|00000d40| 69 72 73 74 20 63 6c 65 | 61 72 20 61 6c 6c 20 62 |irst cle|ar all b|
|00000d50| 69 74 73 20 74 68 61 74 | 20 61 72 65 20 62 65 79 |its that| are bey|
|00000d60| 6f 6e 64 20 74 68 65 20 | 74 79 70 65 27 73 20 70 |ond the |type's p|
|00000d70| 72 65 63 69 73 69 6f 6e | 2e 20 20 2a 2f 0d 0d 20 |recision|. */.. |
|00000d80| 20 69 66 20 28 70 72 65 | 63 20 3d 3d 20 32 20 2a | if (pre|c == 2 *|
|00000d90| 20 48 4f 53 54 5f 42 49 | 54 53 5f 50 45 52 5f 49 | HOST_BI|TS_PER_I|
|00000da0| 4e 54 29 0d 20 20 20 20 | 3b 0d 20 20 65 6c 73 65 |NT). |;. else|
|00000db0| 20 69 66 20 28 70 72 65 | 63 20 3e 20 48 4f 53 54 | if (pre|c > HOST|
|00000dc0| 5f 42 49 54 53 5f 50 45 | 52 5f 49 4e 54 29 0d 20 |_BITS_PE|R_INT). |
|00000dd0| 20 20 20 7b 0d 20 20 20 | 20 20 20 54 52 45 45 5f | {. | TREE_|
|00000de0| 49 4e 54 5f 43 53 54 5f | 48 49 47 48 20 28 74 29 |INT_CST_|HIGH (t)|
|00000df0| 0d 09 26 3d 20 7e 28 28 | 2d 31 29 20 3c 3c 20 28 |..&= ~((|-1) << (|
|00000e00| 70 72 65 63 20 2d 20 48 | 4f 53 54 5f 42 49 54 53 |prec - H|OST_BITS|
|00000e10| 5f 50 45 52 5f 49 4e 54 | 29 29 3b 0d 20 20 20 20 |_PER_INT|));. |
|00000e20| 7d 0d 20 20 65 6c 73 65 | 0d 20 20 20 20 7b 0d 20 |}. else|. {. |
|00000e30| 20 20 20 20 20 54 52 45 | 45 5f 49 4e 54 5f 43 53 | TRE|E_INT_CS|
|00000e40| 54 5f 48 49 47 48 20 28 | 74 29 20 3d 20 30 3b 0d |T_HIGH (|t) = 0;.|
|00000e50| 20 20 20 20 20 20 69 66 | 20 28 70 72 65 63 20 3c | if| (prec <|
|00000e60| 20 48 4f 53 54 5f 42 49 | 54 53 5f 50 45 52 5f 49 | HOST_BI|TS_PER_I|
|00000e70| 4e 54 29 0d 09 54 52 45 | 45 5f 49 4e 54 5f 43 53 |NT)..TRE|E_INT_CS|
|00000e80| 54 5f 4c 4f 57 20 28 74 | 29 0d 09 20 20 26 3d 20 |T_LOW (t|).. &= |
|00000e90| 7e 28 28 2d 31 29 20 3c | 3c 20 70 72 65 63 29 3b |~((-1) <|< prec);|
|00000ea0| 0d 20 20 20 20 7d 0d 0d | 20 20 2f 2a 20 49 66 20 |. }..| /* If |
|00000eb0| 69 74 27 73 20 61 20 73 | 69 67 6e 65 64 20 74 79 |it's a s|igned ty|
|00000ec0| 70 65 20 61 6e 64 20 76 | 61 6c 75 65 27 73 20 73 |pe and v|alue's s|
|00000ed0| 69 67 6e 20 62 69 74 20 | 69 73 20 73 65 74 2c 20 |ign bit |is set, |
|00000ee0| 65 78 74 65 6e 64 20 74 | 68 65 20 73 69 67 6e 2e |extend t|he sign.|
|00000ef0| 20 20 2a 2f 0d 0d 20 20 | 69 66 20 28 21 20 54 52 | */.. |if (! TR|
|00000f00| 45 45 5f 55 4e 53 49 47 | 4e 45 44 20 28 54 52 45 |EE_UNSIG|NED (TRE|
|00000f10| 45 5f 54 59 50 45 20 28 | 74 29 29 0d 20 20 20 20 |E_TYPE (|t)). |
|00000f20| 20 20 26 26 20 70 72 65 | 63 20 21 3d 20 32 20 2a | && pre|c != 2 *|
|00000f30| 20 48 4f 53 54 5f 42 49 | 54 53 5f 50 45 52 5f 49 | HOST_BI|TS_PER_I|
|00000f40| 4e 54 0d 20 20 20 20 20 | 20 26 26 20 28 70 72 65 |NT. | && (pre|
|00000f50| 63 20 3e 20 48 4f 53 54 | 5f 42 49 54 53 5f 50 45 |c > HOST|_BITS_PE|
|00000f60| 52 5f 49 4e 54 0d 09 20 | 20 3f 20 54 52 45 45 5f |R_INT.. | ? TREE_|
|00000f70| 49 4e 54 5f 43 53 54 5f | 48 49 47 48 20 28 74 29 |INT_CST_|HIGH (t)|
|00000f80| 20 26 20 28 31 20 3c 3c | 20 28 70 72 65 63 20 2d | & (1 <<| (prec -|
|00000f90| 20 48 4f 53 54 5f 42 49 | 54 53 5f 50 45 52 5f 49 | HOST_BI|TS_PER_I|
|00000fa0| 4e 54 20 2d 20 31 29 29 | 0d 09 20 20 3a 20 54 52 |NT - 1))|.. : TR|
|00000fb0| 45 45 5f 49 4e 54 5f 43 | 53 54 5f 4c 4f 57 20 28 |EE_INT_C|ST_LOW (|
|00000fc0| 74 29 20 26 20 28 31 20 | 3c 3c 20 28 70 72 65 63 |t) & (1 |<< (prec|
|00000fd0| 20 2d 20 31 29 29 29 29 | 0d 20 20 20 20 7b 0d 20 | - 1))))|. {. |
|00000fe0| 20 20 20 20 20 2f 2a 20 | 56 61 6c 75 65 20 69 73 | /* |Value is|
|00000ff0| 20 6e 65 67 61 74 69 76 | 65 3a 0d 09 20 73 65 74 | negativ|e:.. set|
|00001000| 20 74 6f 20 31 20 61 6c | 6c 20 74 68 65 20 62 69 | to 1 al|l the bi|
|00001010| 74 73 20 74 68 61 74 20 | 61 72 65 20 6f 75 74 73 |ts that |are outs|
|00001020| 69 64 65 20 74 68 69 73 | 20 74 79 70 65 27 73 20 |ide this| type's |
|00001030| 70 72 65 63 69 73 69 6f | 6e 2e 20 20 2a 2f 0d 20 |precisio|n. */. |
|00001040| 20 20 20 20 20 69 66 20 | 28 70 72 65 63 20 3e 20 | if |(prec > |
|00001050| 48 4f 53 54 5f 42 49 54 | 53 5f 50 45 52 5f 49 4e |HOST_BIT|S_PER_IN|
|00001060| 54 29 0d 09 7b 0d 09 20 | 20 54 52 45 45 5f 49 4e |T)..{.. | TREE_IN|
|00001070| 54 5f 43 53 54 5f 48 49 | 47 48 20 28 74 29 0d 09 |T_CST_HI|GH (t)..|
|00001080| 20 20 20 20 7c 3d 20 28 | 28 2d 31 29 20 3c 3c 20 | |= (|(-1) << |
|00001090| 28 70 72 65 63 20 2d 20 | 48 4f 53 54 5f 42 49 54 |(prec - |HOST_BIT|
|000010a0| 53 5f 50 45 52 5f 49 4e | 54 29 29 3b 0d 09 7d 0d |S_PER_IN|T));..}.|
|000010b0| 20 20 20 20 20 20 65 6c | 73 65 0d 09 7b 0d 09 20 | el|se..{.. |
|000010c0| 20 54 52 45 45 5f 49 4e | 54 5f 43 53 54 5f 48 49 | TREE_IN|T_CST_HI|
|000010d0| 47 48 20 28 74 29 20 3d | 20 2d 31 3b 0d 09 20 20 |GH (t) =| -1;.. |
|000010e0| 69 66 20 28 70 72 65 63 | 20 3c 20 48 4f 53 54 5f |if (prec| < HOST_|
|000010f0| 42 49 54 53 5f 50 45 52 | 5f 49 4e 54 29 0d 09 20 |BITS_PER|_INT).. |
|00001100| 20 20 20 54 52 45 45 5f | 49 4e 54 5f 43 53 54 5f | TREE_|INT_CST_|
|00001110| 4c 4f 57 20 28 74 29 0d | 09 20 20 20 20 20 20 7c |LOW (t).|. ||
|00001120| 3d 20 28 28 2d 31 29 20 | 3c 3c 20 70 72 65 63 29 |= ((-1) |<< prec)|
|00001130| 3b 0d 09 7d 0d 20 20 20 | 20 7d 0d 7d 0d 0c 0d 2f |;..}. | }.}.../|
|00001140| 2a 20 41 64 64 20 74 77 | 6f 20 36 34 2d 62 69 74 |* Add tw|o 64-bit|
|00001150| 20 69 6e 74 65 67 65 72 | 73 20 77 69 74 68 20 36 | integer|s with 6|
|00001160| 34 2d 62 69 74 20 72 65 | 73 75 6c 74 2e 0d 20 20 |4-bit re|sult.. |
|00001170| 20 45 61 63 68 20 61 72 | 67 75 6d 65 6e 74 20 69 | Each ar|gument i|
|00001180| 73 20 67 69 76 65 6e 20 | 61 73 20 74 77 6f 20 60 |s given |as two `|
|00001190| 69 6e 74 27 20 70 69 65 | 63 65 73 2e 0d 20 20 20 |int' pie|ces.. |
|000011a0| 4f 6e 65 20 61 72 67 75 | 6d 65 6e 74 20 69 73 20 |One argu|ment is |
|000011b0| 4c 31 20 61 6e 64 20 48 | 31 3b 20 74 68 65 20 6f |L1 and H|1; the o|
|000011c0| 74 68 65 72 2c 20 4c 32 | 20 61 6e 64 20 48 32 2e |ther, L2| and H2.|
|000011d0| 0d 20 20 20 54 68 65 20 | 76 61 6c 75 65 20 69 73 |. The |value is|
|000011e0| 20 73 74 6f 72 65 64 20 | 61 73 20 74 77 6f 20 60 | stored |as two `|
|000011f0| 69 6e 74 27 20 70 69 65 | 63 65 73 20 69 6e 20 2a |int' pie|ces in *|
|00001200| 4c 56 20 61 6e 64 20 2a | 48 56 2e 0d 20 20 20 57 |LV and *|HV.. W|
|00001210| 65 20 75 73 65 20 74 68 | 65 20 38 2d 73 68 6f 72 |e use th|e 8-shor|
|00001220| 74 73 20 72 65 70 72 65 | 73 65 6e 74 61 74 69 6f |ts repre|sentatio|
|00001230| 6e 20 69 6e 74 65 72 6e | 61 6c 6c 79 2e 20 20 2a |n intern|ally. *|
|00001240| 2f 0d 0d 73 74 61 74 69 | 63 20 76 6f 69 64 0d 61 |/..stati|c void.a|
|00001250| 64 64 5f 64 6f 75 62 6c | 65 20 28 6c 31 2c 20 68 |dd_doubl|e (l1, h|
|00001260| 31 2c 20 6c 32 2c 20 68 | 32 2c 20 6c 76 2c 20 68 |1, l2, h|2, lv, h|
|00001270| 76 29 0d 20 20 20 20 20 | 69 6e 74 20 6c 31 2c 20 |v). |int l1, |
|00001280| 68 31 2c 20 6c 32 2c 20 | 68 32 3b 0d 20 20 20 20 |h1, l2, |h2;. |
|00001290| 20 69 6e 74 20 2a 6c 76 | 2c 20 2a 68 76 3b 0d 7b | int *lv|, *hv;.{|
|000012a0| 0d 20 20 73 68 6f 72 74 | 20 61 72 67 31 5b 38 5d |. short| arg1[8]|
|000012b0| 3b 0d 20 20 73 68 6f 72 | 74 20 61 72 67 32 5b 38 |;. shor|t arg2[8|
|000012c0| 5d 3b 0d 20 20 72 65 67 | 69 73 74 65 72 20 69 6e |];. reg|ister in|
|000012d0| 74 20 63 61 72 72 79 20 | 3d 20 30 3b 0d 20 20 72 |t carry |= 0;. r|
|000012e0| 65 67 69 73 74 65 72 20 | 69 6e 74 20 69 3b 0d 0d |egister |int i;..|
|000012f0| 20 20 65 6e 63 6f 64 65 | 20 28 61 72 67 31 2c 20 | encode| (arg1, |
|00001300| 6c 31 2c 20 68 31 29 3b | 0d 20 20 65 6e 63 6f 64 |l1, h1);|. encod|
|00001310| 65 20 28 61 72 67 32 2c | 20 6c 32 2c 20 68 32 29 |e (arg2,| l2, h2)|
|00001320| 3b 0d 0d 20 20 66 6f 72 | 20 28 69 20 3d 20 30 3b |;.. for| (i = 0;|
|00001330| 20 69 20 3c 20 38 3b 20 | 69 2b 2b 29 0d 20 20 20 | i < 8; |i++). |
|00001340| 20 7b 0d 20 20 20 20 20 | 20 63 61 72 72 79 20 2b | {. | carry +|
|00001350| 3d 20 61 72 67 31 5b 69 | 5d 20 2b 20 61 72 67 32 |= arg1[i|] + arg2|
|00001360| 5b 69 5d 3b 0d 20 20 20 | 20 20 20 61 72 67 31 5b |[i];. | arg1[|
|00001370| 69 5d 20 3d 20 63 61 72 | 72 79 20 26 20 30 78 66 |i] = car|ry & 0xf|
|00001380| 66 3b 0d 20 20 20 20 20 | 20 63 61 72 72 79 20 3e |f;. | carry >|
|00001390| 3e 3d 20 38 3b 0d 20 20 | 20 20 7d 0d 0d 20 20 64 |>= 8;. | }.. d|
|000013a0| 65 63 6f 64 65 20 28 61 | 72 67 31 2c 20 6c 76 2c |ecode (a|rg1, lv,|
|000013b0| 20 68 76 29 3b 0d 7d 0d | 0d 2f 2a 20 4e 65 67 61 | hv);.}.|./* Nega|
|000013c0| 74 65 20 61 20 36 34 2d | 62 69 74 20 69 6e 74 65 |te a 64-|bit inte|
|000013d0| 67 65 72 73 20 77 69 74 | 68 20 36 34 2d 62 69 74 |gers wit|h 64-bit|
|000013e0| 20 72 65 73 75 6c 74 2e | 0d 20 20 20 54 68 65 20 | result.|. The |
|000013f0| 61 72 67 75 6d 65 6e 74 | 20 69 73 20 67 69 76 65 |argument| is give|
|00001400| 6e 20 61 73 20 74 77 6f | 20 60 69 6e 74 27 20 70 |n as two| `int' p|
|00001410| 69 65 63 65 73 20 69 6e | 20 4c 31 20 61 6e 64 20 |ieces in| L1 and |
|00001420| 48 31 2e 0d 20 20 20 54 | 68 65 20 76 61 6c 75 65 |H1.. T|he value|
|00001430| 20 69 73 20 73 74 6f 72 | 65 64 20 61 73 20 74 77 | is stor|ed as tw|
|00001440| 6f 20 60 69 6e 74 27 20 | 70 69 65 63 65 73 20 69 |o `int' |pieces i|
|00001450| 6e 20 2a 4c 56 20 61 6e | 64 20 2a 48 56 2e 0d 20 |n *LV an|d *HV.. |
|00001460| 20 20 57 65 20 75 73 65 | 20 74 68 65 20 38 2d 73 | We use| the 8-s|
|00001470| 68 6f 72 74 73 20 72 65 | 70 72 65 73 65 6e 74 61 |horts re|presenta|
|00001480| 74 69 6f 6e 20 69 6e 74 | 65 72 6e 61 6c 6c 79 2e |tion int|ernally.|
|00001490| 20 20 2a 2f 0d 0d 73 74 | 61 74 69 63 20 76 6f 69 | */..st|atic voi|
|000014a0| 64 0d 6e 65 67 5f 64 6f | 75 62 6c 65 20 28 6c 31 |d.neg_do|uble (l1|
|000014b0| 2c 20 68 31 2c 20 6c 76 | 2c 20 68 76 29 0d 20 20 |, h1, lv|, hv). |
|000014c0| 20 20 20 69 6e 74 20 6c | 31 2c 20 68 31 3b 0d 20 | int l|1, h1;. |
|000014d0| 20 20 20 20 69 6e 74 20 | 2a 6c 76 2c 20 2a 68 76 | int |*lv, *hv|
|000014e0| 3b 0d 7b 0d 20 20 69 66 | 20 28 6c 31 20 3d 3d 20 |;.{. if| (l1 == |
|000014f0| 30 29 0d 20 20 20 20 7b | 0d 20 20 20 20 20 20 2a |0). {|. *|
|00001500| 6c 76 20 3d 20 30 3b 0d | 20 20 20 20 20 20 2a 68 |lv = 0;.| *h|
|00001510| 76 20 3d 20 2d 20 68 31 | 3b 0d 20 20 20 20 7d 0d |v = - h1|;. }.|
|00001520| 20 20 65 6c 73 65 0d 20 | 20 20 20 7b 0d 20 20 20 | else. | {. |
|00001530| 20 20 20 2a 6c 76 20 3d | 20 2d 20 6c 31 3b 0d 20 | *lv =| - l1;. |
|00001540| 20 20 20 20 20 2a 68 76 | 20 3d 20 7e 20 68 31 3b | *hv| = ~ h1;|
|00001550| 0d 20 20 20 20 7d 0d 7d | 0d 0c 0d 2f 2a 20 4d 75 |. }.}|.../* Mu|
|00001560| 6c 74 69 70 6c 79 20 74 | 77 6f 20 36 34 2d 62 69 |ltiply t|wo 64-bi|
|00001570| 74 20 69 6e 74 65 67 65 | 72 73 20 77 69 74 68 20 |t intege|rs with |
|00001580| 36 34 2d 62 69 74 20 72 | 65 73 75 6c 74 2e 0d 20 |64-bit r|esult.. |
|00001590| 20 20 45 61 63 68 20 61 | 72 67 75 6d 65 6e 74 20 | Each a|rgument |
|000015a0| 69 73 20 67 69 76 65 6e | 20 61 73 20 74 77 6f 20 |is given| as two |
|000015b0| 60 69 6e 74 27 20 70 69 | 65 63 65 73 2e 0d 20 20 |`int' pi|eces.. |
|000015c0| 20 4f 6e 65 20 61 72 67 | 75 6d 65 6e 74 20 69 73 | One arg|ument is|
|000015d0| 20 4c 31 20 61 6e 64 20 | 48 31 3b 20 74 68 65 20 | L1 and |H1; the |
|000015e0| 6f 74 68 65 72 2c 20 4c | 32 20 61 6e 64 20 48 32 |other, L|2 and H2|
|000015f0| 2e 0d 20 20 20 54 68 65 | 20 76 61 6c 75 65 20 69 |.. The| value i|
|00001600| 73 20 73 74 6f 72 65 64 | 20 61 73 20 74 77 6f 20 |s stored| as two |
|00001610| 60 69 6e 74 27 20 70 69 | 65 63 65 73 20 69 6e 20 |`int' pi|eces in |
|00001620| 2a 4c 56 20 61 6e 64 20 | 2a 48 56 2e 0d 20 20 20 |*LV and |*HV.. |
|00001630| 57 65 20 75 73 65 20 74 | 68 65 20 38 2d 73 68 6f |We use t|he 8-sho|
|00001640| 72 74 73 20 72 65 70 72 | 65 73 65 6e 74 61 74 69 |rts repr|esentati|
|00001650| 6f 6e 20 69 6e 74 65 72 | 6e 61 6c 6c 79 2e 20 20 |on inter|nally. |
|00001660| 2a 2f 0d 0d 73 74 61 74 | 69 63 20 76 6f 69 64 0d |*/..stat|ic void.|
|00001670| 6d 75 6c 5f 64 6f 75 62 | 6c 65 20 28 6c 31 2c 20 |mul_doub|le (l1, |
|00001680| 68 31 2c 20 6c 32 2c 20 | 68 32 2c 20 6c 76 2c 20 |h1, l2, |h2, lv, |
|00001690| 68 76 29 0d 20 20 20 20 | 20 69 6e 74 20 6c 31 2c |hv). | int l1,|
|000016a0| 20 68 31 2c 20 6c 32 2c | 20 68 32 3b 0d 20 20 20 | h1, l2,| h2;. |
|000016b0| 20 20 69 6e 74 20 2a 6c | 76 2c 20 2a 68 76 3b 0d | int *l|v, *hv;.|
|000016c0| 7b 0d 20 20 73 68 6f 72 | 74 20 61 72 67 31 5b 38 |{. shor|t arg1[8|
|000016d0| 5d 3b 0d 20 20 73 68 6f | 72 74 20 61 72 67 32 5b |];. sho|rt arg2[|
|000016e0| 38 5d 3b 0d 20 20 73 68 | 6f 72 74 20 70 72 6f 64 |8];. sh|ort prod|
|000016f0| 5b 31 36 5d 3b 0d 20 20 | 72 65 67 69 73 74 65 72 |[16];. |register|
|00001700| 20 69 6e 74 20 63 61 72 | 72 79 20 3d 20 30 3b 0d | int car|ry = 0;.|
|00001710| 20 20 72 65 67 69 73 74 | 65 72 20 69 6e 74 20 69 | regist|er int i|
|00001720| 2c 20 6a 2c 20 6b 3b 0d | 0d 20 20 2f 2a 20 54 68 |, j, k;.|. /* Th|
|00001730| 65 73 65 20 74 77 6f 20 | 63 61 73 65 73 20 61 72 |ese two |cases ar|
|00001740| 65 20 75 73 65 64 20 65 | 78 74 65 6e 73 69 76 65 |e used e|xtensive|
|00001750| 6c 79 2c 20 61 72 69 73 | 69 6e 67 20 66 72 6f 6d |ly, aris|ing from|
|00001760| 20 70 6f 69 6e 74 65 72 | 0d 20 20 20 20 20 63 6f | pointer|. co|
|00001770| 6d 62 69 6e 61 74 69 6f | 6e 73 2e 20 20 2a 2f 0d |mbinatio|ns. */.|
|00001780| 20 20 69 66 20 28 68 32 | 20 3d 3d 20 30 29 0d 20 | if (h2| == 0). |
|00001790| 20 20 20 7b 0d 20 20 20 | 20 20 20 69 66 20 28 6c | {. | if (l|
|000017a0| 32 20 3d 3d 20 32 29 0d | 09 7b 0d 09 20 20 75 6e |2 == 2).|.{.. un|
|000017b0| 73 69 67 6e 65 64 20 74 | 65 6d 70 20 3d 20 6c 31 |signed t|emp = l1|
|000017c0| 20 2b 20 6c 31 3b 0d 09 | 20 20 2a 68 76 20 3d 20 | + l1;..| *hv = |
|000017d0| 68 31 20 2a 20 32 20 2b | 20 28 74 65 6d 70 20 3c |h1 * 2 +| (temp <|
|000017e0| 20 6c 31 29 3b 0d 09 20 | 20 2a 6c 76 20 3d 20 74 | l1);.. | *lv = t|
|000017f0| 65 6d 70 3b 0d 09 20 20 | 72 65 74 75 72 6e 3b 0d |emp;.. |return;.|
|00001800| 09 7d 0d 20 20 20 20 20 | 20 69 66 20 28 6c 32 20 |.}. | if (l2 |
|00001810| 3d 3d 20 34 29 0d 09 7b | 0d 09 20 20 75 6e 73 69 |== 4)..{|.. unsi|
|00001820| 67 6e 65 64 20 74 65 6d | 70 20 3d 20 6c 31 20 2b |gned tem|p = l1 +|
|00001830| 20 6c 31 3b 0d 09 20 20 | 68 31 20 3d 20 68 31 20 | l1;.. |h1 = h1 |
|00001840| 2a 20 34 20 2b 20 28 74 | 65 6d 70 20 3c 20 6c 31 |* 4 + (t|emp < l1|
|00001850| 29 20 3c 3c 20 31 3b 0d | 09 20 20 6c 31 20 3d 20 |) << 1;.|. l1 = |
|00001860| 74 65 6d 70 3b 0d 09 20 | 20 74 65 6d 70 20 2b 3d |temp;.. | temp +=|
|00001870| 20 74 65 6d 70 3b 0d 09 | 20 20 68 31 20 2b 3d 20 | temp;..| h1 += |
|00001880| 28 74 65 6d 70 20 3c 20 | 6c 31 29 3b 0d 09 20 20 |(temp < |l1);.. |
|00001890| 2a 6c 76 20 3d 20 74 65 | 6d 70 3b 0d 09 20 20 2a |*lv = te|mp;.. *|
|000018a0| 68 76 20 3d 20 68 31 3b | 0d 09 20 20 72 65 74 75 |hv = h1;|.. retu|
|000018b0| 72 6e 3b 0d 09 7d 0d 20 | 20 20 20 20 20 69 66 20 |rn;..}. | if |
|000018c0| 28 6c 32 20 3d 3d 20 38 | 29 0d 09 7b 0d 09 20 20 |(l2 == 8|)..{.. |
|000018d0| 75 6e 73 69 67 6e 65 64 | 20 74 65 6d 70 20 3d 20 |unsigned| temp = |
|000018e0| 6c 31 20 2b 20 6c 31 3b | 0d 09 20 20 68 31 20 3d |l1 + l1;|.. h1 =|
|000018f0| 20 68 31 20 2a 20 38 20 | 2b 20 28 74 65 6d 70 20 | h1 * 8 |+ (temp |
|00001900| 3c 20 6c 31 29 20 3c 3c | 20 32 3b 0d 09 20 20 6c |< l1) <<| 2;.. l|
|00001910| 31 20 3d 20 74 65 6d 70 | 3b 0d 09 20 20 74 65 6d |1 = temp|;.. tem|
|00001920| 70 20 2b 3d 20 74 65 6d | 70 3b 0d 09 20 20 68 31 |p += tem|p;.. h1|
|00001930| 20 2b 3d 20 28 74 65 6d | 70 20 3c 20 6c 31 29 20 | += (tem|p < l1) |
|00001940| 3c 3c 20 31 3b 0d 09 20 | 20 6c 31 20 3d 20 74 65 |<< 1;.. | l1 = te|
|00001950| 6d 70 3b 0d 09 20 20 74 | 65 6d 70 20 2b 3d 20 74 |mp;.. t|emp += t|
|00001960| 65 6d 70 3b 0d 09 20 20 | 68 31 20 2b 3d 20 28 74 |emp;.. |h1 += (t|
|00001970| 65 6d 70 20 3c 20 6c 31 | 29 3b 0d 09 20 20 2a 6c |emp < l1|);.. *l|
|00001980| 76 20 3d 20 74 65 6d 70 | 3b 0d 09 20 20 2a 68 76 |v = temp|;.. *hv|
|00001990| 20 3d 20 68 31 3b 0d 09 | 20 20 72 65 74 75 72 6e | = h1;..| return|
|000019a0| 3b 0d 09 7d 0d 20 20 20 | 20 7d 0d 0d 20 20 65 6e |;..}. | }.. en|
|000019b0| 63 6f 64 65 20 28 61 72 | 67 31 2c 20 6c 31 2c 20 |code (ar|g1, l1, |
|000019c0| 68 31 29 3b 0d 20 20 65 | 6e 63 6f 64 65 20 28 61 |h1);. e|ncode (a|
|000019d0| 72 67 32 2c 20 6c 32 2c | 20 68 32 29 3b 0d 0d 20 |rg2, l2,| h2);.. |
|000019e0| 20 62 7a 65 72 6f 20 28 | 70 72 6f 64 2c 20 73 69 | bzero (|prod, si|
|000019f0| 7a 65 6f 66 20 70 72 6f | 64 29 3b 0d 0d 20 20 66 |zeof pro|d);.. f|
|00001a00| 6f 72 20 28 69 20 3d 20 | 30 3b 20 69 20 3c 20 38 |or (i = |0; i < 8|
|00001a10| 3b 20 69 2b 2b 29 0d 20 | 20 20 20 66 6f 72 20 28 |; i++). | for (|
|00001a20| 6a 20 3d 20 30 3b 20 6a | 20 3c 20 38 3b 20 6a 2b |j = 0; j| < 8; j+|
|00001a30| 2b 29 0d 20 20 20 20 20 | 20 7b 0d 09 6b 20 3d 20 |+). | {..k = |
|00001a40| 69 20 2b 20 6a 3b 0d 09 | 63 61 72 72 79 20 3d 20 |i + j;..|carry = |
|00001a50| 61 72 67 31 5b 69 5d 20 | 2a 20 61 72 67 32 5b 6a |arg1[i] |* arg2[j|
|00001a60| 5d 3b 0d 09 77 68 69 6c | 65 20 28 63 61 72 72 79 |];..whil|e (carry|
|00001a70| 29 0d 09 20 20 7b 0d 09 | 20 20 20 20 63 61 72 72 |).. {..| carr|
|00001a80| 79 20 2b 3d 20 70 72 6f | 64 5b 6b 5d 3b 0d 09 20 |y += pro|d[k];.. |
|00001a90| 20 20 20 70 72 6f 64 5b | 6b 5d 20 3d 20 63 61 72 | prod[|k] = car|
|00001aa0| 72 79 20 26 20 30 78 66 | 66 3b 0d 09 20 20 20 20 |ry & 0xf|f;.. |
|00001ab0| 63 61 72 72 79 20 3e 3e | 3d 20 38 3b 0d 09 20 20 |carry >>|= 8;.. |
|00001ac0| 20 20 6b 2b 2b 3b 0d 09 | 20 20 7d 0d 20 20 20 20 | k++;..| }. |
|00001ad0| 20 20 7d 0d 0d 20 20 64 | 65 63 6f 64 65 20 28 70 | }.. d|ecode (p|
|00001ae0| 72 6f 64 2c 20 6c 76 2c | 20 68 76 29 3b 09 2f 2a |rod, lv,| hv);./*|
|00001af0| 20 40 40 64 65 63 6f 64 | 65 20 69 67 6e 6f 72 65 | @@decod|e ignore|
|00001b00| 73 20 70 72 6f 64 5b 38 | 5d 20 2d 3e 20 70 72 6f |s prod[8|] -> pro|
|00001b10| 64 5b 31 35 5d 20 2a 2f | 0d 7d 0d 0c 0d 2f 2a 20 |d[15] */|.}.../* |
|00001b20| 53 68 69 66 74 20 74 68 | 65 20 36 34 2d 62 69 74 |Shift th|e 64-bit|
|00001b30| 20 69 6e 74 65 67 65 72 | 20 69 6e 20 4c 31 2c 20 | integer| in L1, |
|00001b40| 48 31 20 6c 65 66 74 20 | 62 79 20 43 4f 55 4e 54 |H1 left |by COUNT|
|00001b50| 20 70 6c 61 63 65 73 0d | 20 20 20 6b 65 65 70 69 | places.| keepi|
|00001b60| 6e 67 20 6f 6e 6c 79 20 | 50 52 45 43 20 62 69 74 |ng only |PREC bit|
|00001b70| 73 20 6f 66 20 72 65 73 | 75 6c 74 2e 0d 20 20 20 |s of res|ult.. |
|00001b80| 53 68 69 66 74 20 72 69 | 67 68 74 20 69 66 20 43 |Shift ri|ght if C|
|00001b90| 4f 55 4e 54 20 69 73 20 | 6e 65 67 61 74 69 76 65 |OUNT is |negative|
|00001ba0| 2e 0d 20 20 20 41 52 49 | 54 48 20 6e 6f 6e 7a 65 |.. ARI|TH nonze|
|00001bb0| 72 6f 20 73 70 65 63 69 | 66 69 65 73 20 61 72 69 |ro speci|fies ari|
|00001bc0| 74 68 6d 65 74 69 63 20 | 73 68 69 66 74 69 6e 67 |thmetic |shifting|
|00001bd0| 3b 20 6f 74 68 65 72 77 | 69 73 65 20 75 73 65 20 |; otherw|ise use |
|00001be0| 6c 6f 67 69 63 61 6c 20 | 73 68 69 66 74 2e 0d 20 |logical |shift.. |
|00001bf0| 20 20 53 74 6f 72 65 20 | 74 68 65 20 76 61 6c 75 | Store |the valu|
|00001c00| 65 20 61 73 20 74 77 6f | 20 60 69 6e 74 27 20 70 |e as two| `int' p|
|00001c10| 69 65 63 65 73 20 69 6e | 20 2a 4c 56 20 61 6e 64 |ieces in| *LV and|
|00001c20| 20 2a 48 56 2e 20 20 2a | 2f 0d 0d 73 74 61 74 69 | *HV. *|/..stati|
|00001c30| 63 20 76 6f 69 64 0d 6c | 73 68 69 66 74 5f 64 6f |c void.l|shift_do|
|00001c40| 75 62 6c 65 20 28 6c 31 | 2c 20 68 31 2c 20 63 6f |uble (l1|, h1, co|
|00001c50| 75 6e 74 2c 20 70 72 65 | 63 2c 20 6c 76 2c 20 68 |unt, pre|c, lv, h|
|00001c60| 76 2c 20 61 72 69 74 68 | 29 0d 20 20 20 20 20 69 |v, arith|). i|
|00001c70| 6e 74 20 6c 31 2c 20 68 | 31 2c 20 63 6f 75 6e 74 |nt l1, h|1, count|
|00001c80| 2c 20 70 72 65 63 3b 0d | 20 20 20 20 20 69 6e 74 |, prec;.| int|
|00001c90| 20 2a 6c 76 2c 20 2a 68 | 76 3b 0d 20 20 20 20 20 | *lv, *h|v;. |
|00001ca0| 69 6e 74 20 61 72 69 74 | 68 3b 0d 7b 0d 20 20 73 |int arit|h;.{. s|
|00001cb0| 68 6f 72 74 20 61 72 67 | 31 5b 38 5d 3b 0d 20 20 |hort arg|1[8];. |
|00001cc0| 72 65 67 69 73 74 65 72 | 20 69 6e 74 20 69 3b 0d |register| int i;.|
|00001cd0| 20 20 72 65 67 69 73 74 | 65 72 20 69 6e 74 20 63 | regist|er int c|
|00001ce0| 61 72 72 79 3b 0d 0d 20 | 20 69 66 20 28 63 6f 75 |arry;.. | if (cou|
|00001cf0| 6e 74 20 3c 20 30 29 0d | 20 20 20 20 7b 0d 20 20 |nt < 0).| {. |
|00001d00| 20 20 20 20 72 73 68 69 | 66 74 5f 64 6f 75 62 6c | rshi|ft_doubl|
|00001d10| 65 20 28 6c 31 2c 20 68 | 31 2c 20 2d 20 63 6f 75 |e (l1, h|1, - cou|
|00001d20| 6e 74 2c 20 70 72 65 63 | 2c 20 6c 76 2c 20 68 76 |nt, prec|, lv, hv|
|00001d30| 2c 20 61 72 69 74 68 29 | 3b 0d 20 20 20 20 20 20 |, arith)|;. |
|00001d40| 72 65 74 75 72 6e 3b 0d | 20 20 20 20 7d 0d 0d 20 |return;.| }.. |
|00001d50| 20 65 6e 63 6f 64 65 20 | 28 61 72 67 31 2c 20 6c | encode |(arg1, l|
|00001d60| 31 2c 20 68 31 29 3b 0d | 0d 20 20 69 66 20 28 63 |1, h1);.|. if (c|
|00001d70| 6f 75 6e 74 20 3e 20 70 | 72 65 63 29 0d 20 20 20 |ount > p|rec). |
|00001d80| 20 63 6f 75 6e 74 20 3d | 20 70 72 65 63 3b 0d 0d | count =| prec;..|
|00001d90| 20 20 77 68 69 6c 65 20 | 28 63 6f 75 6e 74 20 3e | while |(count >|
|00001da0| 20 30 29 0d 20 20 20 20 | 7b 0d 20 20 20 20 20 20 | 0). |{. |
|00001db0| 63 61 72 72 79 20 3d 20 | 30 3b 0d 20 20 20 20 20 |carry = |0;. |
|00001dc0| 20 66 6f 72 20 28 69 20 | 3d 20 30 3b 20 69 20 3c | for (i |= 0; i <|
|00001dd0| 20 38 3b 20 69 2b 2b 29 | 0d 09 7b 0d 09 20 20 63 | 8; i++)|..{.. c|
|00001de0| 61 72 72 79 20 2b 3d 20 | 61 72 67 31 5b 69 5d 20 |arry += |arg1[i] |
|00001df0| 3c 3c 20 31 3b 0d 09 20 | 20 61 72 67 31 5b 69 5d |<< 1;.. | arg1[i]|
|00001e00| 20 3d 20 63 61 72 72 79 | 20 26 20 30 78 66 66 3b | = carry| & 0xff;|
|00001e10| 0d 09 20 20 63 61 72 72 | 79 20 3e 3e 3d 20 38 3b |.. carr|y >>= 8;|
|00001e20| 0d 09 7d 0d 20 20 20 20 | 20 20 63 6f 75 6e 74 2d |..}. | count-|
|00001e30| 2d 3b 0d 20 20 20 20 7d | 0d 0d 20 20 64 65 63 6f |-;. }|.. deco|
|00001e40| 64 65 20 28 61 72 67 31 | 2c 20 6c 76 2c 20 68 76 |de (arg1|, lv, hv|
|00001e50| 29 3b 0d 7d 0d 0d 2f 2a | 20 53 68 69 66 74 20 74 |);.}../*| Shift t|
|00001e60| 68 65 20 36 34 2d 62 69 | 74 20 69 6e 74 65 67 65 |he 64-bi|t intege|
|00001e70| 72 20 69 6e 20 4c 31 2c | 20 48 31 20 72 69 67 68 |r in L1,| H1 righ|
|00001e80| 74 20 62 79 20 43 4f 55 | 4e 54 20 70 6c 61 63 65 |t by COU|NT place|
|00001e90| 73 0d 20 20 20 6b 65 65 | 70 69 6e 67 20 6f 6e 6c |s. kee|ping onl|
|00001ea0| 79 20 50 52 45 43 20 62 | 69 74 73 20 6f 66 20 72 |y PREC b|its of r|
|00001eb0| 65 73 75 6c 74 2e 20 20 | 43 4f 55 4e 54 20 6d 75 |esult. |COUNT mu|
|00001ec0| 73 74 20 62 65 20 70 6f | 73 69 74 69 76 65 2e 0d |st be po|sitive..|
|00001ed0| 20 20 20 41 52 49 54 48 | 20 6e 6f 6e 7a 65 72 6f | ARITH| nonzero|
|00001ee0| 20 73 70 65 63 69 66 69 | 65 73 20 61 72 69 74 68 | specifi|es arith|
|00001ef0| 6d 65 74 69 63 20 73 68 | 69 66 74 69 6e 67 3b 20 |metic sh|ifting; |
|00001f00| 6f 74 68 65 72 77 69 73 | 65 20 75 73 65 20 6c 6f |otherwis|e use lo|
|00001f10| 67 69 63 61 6c 20 73 68 | 69 66 74 2e 0d 20 20 20 |gical sh|ift.. |
|00001f20| 53 74 6f 72 65 20 74 68 | 65 20 76 61 6c 75 65 20 |Store th|e value |
|00001f30| 61 73 20 74 77 6f 20 60 | 69 6e 74 27 20 70 69 65 |as two `|int' pie|
|00001f40| 63 65 73 20 69 6e 20 2a | 4c 56 20 61 6e 64 20 2a |ces in *|LV and *|
|00001f50| 48 56 2e 20 20 2a 2f 0d | 0d 73 74 61 74 69 63 20 |HV. */.|.static |
|00001f60| 76 6f 69 64 0d 72 73 68 | 69 66 74 5f 64 6f 75 62 |void.rsh|ift_doub|
|00001f70| 6c 65 20 28 6c 31 2c 20 | 68 31 2c 20 63 6f 75 6e |le (l1, |h1, coun|
|00001f80| 74 2c 20 70 72 65 63 2c | 20 6c 76 2c 20 68 76 2c |t, prec,| lv, hv,|
|00001f90| 20 61 72 69 74 68 29 0d | 20 20 20 20 20 69 6e 74 | arith).| int|
|00001fa0| 20 6c 31 2c 20 68 31 2c | 20 63 6f 75 6e 74 2c 20 | l1, h1,| count, |
|00001fb0| 70 72 65 63 3b 0d 20 20 | 20 20 20 69 6e 74 20 2a |prec;. | int *|
|00001fc0| 6c 76 2c 20 2a 68 76 3b | 0d 20 20 20 20 20 69 6e |lv, *hv;|. in|
|00001fd0| 74 20 61 72 69 74 68 3b | 0d 7b 0d 20 20 73 68 6f |t arith;|.{. sho|
|00001fe0| 72 74 20 61 72 67 31 5b | 38 5d 3b 0d 20 20 72 65 |rt arg1[|8];. re|
|00001ff0| 67 69 73 74 65 72 20 69 | 6e 74 20 69 3b 0d 20 20 |gister i|nt i;. |
|00002000| 72 65 67 69 73 74 65 72 | 20 69 6e 74 20 63 61 72 |register| int car|
|00002010| 72 79 3b 0d 0d 20 20 65 | 6e 63 6f 64 65 20 28 61 |ry;.. e|ncode (a|
|00002020| 72 67 31 2c 20 6c 31 2c | 20 68 31 29 3b 0d 0d 20 |rg1, l1,| h1);.. |
|00002030| 20 69 66 20 28 63 6f 75 | 6e 74 20 3e 20 70 72 65 | if (cou|nt > pre|
|00002040| 63 29 0d 20 20 20 20 63 | 6f 75 6e 74 20 3d 20 70 |c). c|ount = p|
|00002050| 72 65 63 3b 0d 0d 20 20 | 63 61 72 72 79 20 3d 20 |rec;.. |carry = |
|00002060| 61 72 69 74 68 20 26 26 | 20 61 72 67 31 5b 37 5d |arith &&| arg1[7]|
|00002070| 20 3e 3e 20 37 3b 0d 20 | 20 77 68 69 6c 65 20 28 | >> 7;. | while (|
|00002080| 63 6f 75 6e 74 20 3e 20 | 30 29 0d 20 20 20 20 7b |count > |0). {|
|00002090| 0d 20 20 20 20 20 20 66 | 6f 72 20 28 69 20 3d 20 |. f|or (i = |
|000020a0| 37 3b 20 69 20 3e 3d 20 | 30 3b 20 69 2d 2d 29 0d |7; i >= |0; i--).|
|000020b0| 09 7b 0d 09 20 20 63 61 | 72 72 79 20 3c 3c 3d 20 |.{.. ca|rry <<= |
|000020c0| 38 3b 0d 09 20 20 63 61 | 72 72 79 20 2b 3d 20 61 |8;.. ca|rry += a|
|000020d0| 72 67 31 5b 69 5d 3b 0d | 09 20 20 61 72 67 31 5b |rg1[i];.|. arg1[|
|000020e0| 69 5d 20 3d 20 28 63 61 | 72 72 79 20 3e 3e 20 31 |i] = (ca|rry >> 1|
|000020f0| 29 20 26 20 30 78 66 66 | 3b 0d 09 7d 0d 20 20 20 |) & 0xff|;..}. |
|00002100| 20 20 20 63 6f 75 6e 74 | 2d 2d 3b 0d 20 20 20 20 | count|--;. |
|00002110| 7d 0d 0d 20 20 64 65 63 | 6f 64 65 20 28 61 72 67 |}.. dec|ode (arg|
|00002120| 31 2c 20 6c 76 2c 20 68 | 76 29 3b 0d 7d 0d 0c 0d |1, lv, h|v);.}...|
|00002130| 2f 2a 20 52 6f 74 61 74 | 65 20 74 68 65 20 36 34 |/* Rotat|e the 64|
|00002140| 2d 62 69 74 20 69 6e 74 | 65 67 65 72 20 69 6e 20 |-bit int|eger in |
|00002150| 4c 31 2c 20 48 31 20 6c | 65 66 74 20 62 79 20 43 |L1, H1 l|eft by C|
|00002160| 4f 55 4e 54 20 70 6c 61 | 63 65 73 0d 20 20 20 6b |OUNT pla|ces. k|
|00002170| 65 65 70 69 6e 67 20 6f | 6e 6c 79 20 50 52 45 43 |eeping o|nly PREC|
|00002180| 20 62 69 74 73 20 6f 66 | 20 72 65 73 75 6c 74 2e | bits of| result.|
|00002190| 0d 20 20 20 52 6f 74 61 | 74 65 20 72 69 67 68 74 |. Rota|te right|
|000021a0| 20 69 66 20 43 4f 55 4e | 54 20 69 73 20 6e 65 67 | if COUN|T is neg|
|000021b0| 61 74 69 76 65 2e 0d 20 | 20 20 53 74 6f 72 65 20 |ative.. | Store |
|000021c0| 74 68 65 20 76 61 6c 75 | 65 20 61 73 20 74 77 6f |the valu|e as two|
|000021d0| 20 60 69 6e 74 27 20 70 | 69 65 63 65 73 20 69 6e | `int' p|ieces in|
|000021e0| 20 2a 4c 56 20 61 6e 64 | 20 2a 48 56 2e 20 20 2a | *LV and| *HV. *|
|000021f0| 2f 0d 0d 73 74 61 74 69 | 63 20 76 6f 69 64 0d 6c |/..stati|c void.l|
|00002200| 72 6f 74 61 74 65 5f 64 | 6f 75 62 6c 65 20 28 6c |rotate_d|ouble (l|
|00002210| 31 2c 20 68 31 2c 20 63 | 6f 75 6e 74 2c 20 70 72 |1, h1, c|ount, pr|
|00002220| 65 63 2c 20 6c 76 2c 20 | 68 76 29 0d 20 20 20 20 |ec, lv, |hv). |
|00002230| 20 69 6e 74 20 6c 31 2c | 20 68 31 2c 20 63 6f 75 | int l1,| h1, cou|
|00002240| 6e 74 2c 20 70 72 65 63 | 3b 0d 20 20 20 20 20 69 |nt, prec|;. i|
|00002250| 6e 74 20 2a 6c 76 2c 20 | 2a 68 76 3b 0d 7b 0d 20 |nt *lv, |*hv;.{. |
|00002260| 20 73 68 6f 72 74 20 61 | 72 67 31 5b 38 5d 3b 0d | short a|rg1[8];.|
|00002270| 20 20 72 65 67 69 73 74 | 65 72 20 69 6e 74 20 69 | regist|er int i|
|00002280| 3b 0d 20 20 72 65 67 69 | 73 74 65 72 20 69 6e 74 |;. regi|ster int|
|00002290| 20 63 61 72 72 79 3b 0d | 0d 20 20 69 66 20 28 63 | carry;.|. if (c|
|000022a0| 6f 75 6e 74 20 3c 20 30 | 29 0d 20 20 20 20 7b 0d |ount < 0|). {.|
|000022b0| 20 20 20 20 20 20 72 72 | 6f 74 61 74 65 5f 64 6f | rr|otate_do|
|000022c0| 75 62 6c 65 20 28 6c 31 | 2c 20 68 31 2c 20 2d 20 |uble (l1|, h1, - |
|000022d0| 63 6f 75 6e 74 2c 20 70 | 72 65 63 2c 20 6c 76 2c |count, p|rec, lv,|
|000022e0| 20 68 76 29 3b 0d 20 20 | 20 20 20 20 72 65 74 75 | hv);. | retu|
|000022f0| 72 6e 3b 0d 20 20 20 20 | 7d 0d 0d 20 20 65 6e 63 |rn;. |}.. enc|
|00002300| 6f 64 65 20 28 61 72 67 | 31 2c 20 6c 31 2c 20 68 |ode (arg|1, l1, h|
|00002310| 31 29 3b 0d 0d 20 20 69 | 66 20 28 63 6f 75 6e 74 |1);.. i|f (count|
|00002320| 20 3e 20 70 72 65 63 29 | 0d 20 20 20 20 63 6f 75 | > prec)|. cou|
|00002330| 6e 74 20 3d 20 70 72 65 | 63 3b 0d 0d 20 20 63 61 |nt = pre|c;.. ca|
|00002340| 72 72 79 20 3d 20 61 72 | 67 31 5b 37 5d 20 3e 3e |rry = ar|g1[7] >>|
|00002350| 20 37 3b 0d 20 20 77 68 | 69 6c 65 20 28 63 6f 75 | 7;. wh|ile (cou|
|00002360| 6e 74 20 3e 20 30 29 0d | 20 20 20 20 7b 0d 20 20 |nt > 0).| {. |
|00002370| 20 20 20 20 66 6f 72 20 | 28 69 20 3d 20 30 3b 20 | for |(i = 0; |
|00002380| 69 20 3c 20 38 3b 20 69 | 2b 2b 29 0d 09 7b 0d 09 |i < 8; i|++)..{..|
|00002390| 20 20 63 61 72 72 79 20 | 2b 3d 20 61 72 67 31 5b | carry |+= arg1[|
|000023a0| 69 5d 20 3c 3c 20 31 3b | 0d 09 20 20 61 72 67 31 |i] << 1;|.. arg1|
|000023b0| 5b 69 5d 20 3d 20 63 61 | 72 72 79 20 26 20 30 78 |[i] = ca|rry & 0x|
|000023c0| 66 66 3b 0d 09 20 20 63 | 61 72 72 79 20 3e 3e 3d |ff;.. c|arry >>=|
|000023d0| 20 38 3b 0d 09 7d 0d 20 | 20 20 20 20 20 63 6f 75 | 8;..}. | cou|
|000023e0| 6e 74 2d 2d 3b 0d 20 20 | 20 20 7d 0d 0d 20 20 64 |nt--;. | }.. d|
|000023f0| 65 63 6f 64 65 20 28 61 | 72 67 31 2c 20 6c 76 2c |ecode (a|rg1, lv,|
|00002400| 20 68 76 29 3b 0d 7d 0d | 0d 2f 2a 20 52 6f 74 61 | hv);.}.|./* Rota|
|00002410| 74 65 20 74 68 65 20 36 | 34 2d 62 69 74 20 69 6e |te the 6|4-bit in|
|00002420| 74 65 67 65 72 20 69 6e | 20 4c 31 2c 20 48 31 20 |teger in| L1, H1 |
|00002430| 6c 65 66 74 20 62 79 20 | 43 4f 55 4e 54 20 70 6c |left by |COUNT pl|
|00002440| 61 63 65 73 0d 20 20 20 | 6b 65 65 70 69 6e 67 20 |aces. |keeping |
|00002450| 6f 6e 6c 79 20 50 52 45 | 43 20 62 69 74 73 20 6f |only PRE|C bits o|
|00002460| 66 20 72 65 73 75 6c 74 | 2e 20 20 43 4f 55 4e 54 |f result|. COUNT|
|00002470| 20 6d 75 73 74 20 62 65 | 20 70 6f 73 69 74 69 76 | must be| positiv|
|00002480| 65 2e 0d 20 20 20 53 74 | 6f 72 65 20 74 68 65 20 |e.. St|ore the |
|00002490| 76 61 6c 75 65 20 61 73 | 20 74 77 6f 20 60 69 6e |value as| two `in|
|000024a0| 74 27 20 70 69 65 63 65 | 73 20 69 6e 20 2a 4c 56 |t' piece|s in *LV|
|000024b0| 20 61 6e 64 20 2a 48 56 | 2e 20 20 2a 2f 0d 0d 73 | and *HV|. */..s|
|000024c0| 74 61 74 69 63 20 76 6f | 69 64 0d 72 72 6f 74 61 |tatic vo|id.rrota|
|000024d0| 74 65 5f 64 6f 75 62 6c | 65 20 28 6c 31 2c 20 68 |te_doubl|e (l1, h|
|000024e0| 31 2c 20 63 6f 75 6e 74 | 2c 20 70 72 65 63 2c 20 |1, count|, prec, |
|000024f0| 6c 76 2c 20 68 76 29 0d | 20 20 20 20 20 69 6e 74 |lv, hv).| int|
|00002500| 20 6c 31 2c 20 68 31 2c | 20 63 6f 75 6e 74 2c 20 | l1, h1,| count, |
|00002510| 70 72 65 63 3b 0d 20 20 | 20 20 20 69 6e 74 20 2a |prec;. | int *|
|00002520| 6c 76 2c 20 2a 68 76 3b | 0d 7b 0d 20 20 73 68 6f |lv, *hv;|.{. sho|
|00002530| 72 74 20 61 72 67 31 5b | 38 5d 3b 0d 20 20 72 65 |rt arg1[|8];. re|
|00002540| 67 69 73 74 65 72 20 69 | 6e 74 20 69 3b 0d 20 20 |gister i|nt i;. |
|00002550| 72 65 67 69 73 74 65 72 | 20 69 6e 74 20 63 61 72 |register| int car|
|00002560| 72 79 3b 0d 0d 20 20 65 | 6e 63 6f 64 65 20 28 61 |ry;.. e|ncode (a|
|00002570| 72 67 31 2c 20 6c 31 2c | 20 68 31 29 3b 0d 0d 20 |rg1, l1,| h1);.. |
|00002580| 20 69 66 20 28 63 6f 75 | 6e 74 20 3e 20 70 72 65 | if (cou|nt > pre|
|00002590| 63 29 0d 20 20 20 20 63 | 6f 75 6e 74 20 3d 20 70 |c). c|ount = p|
|000025a0| 72 65 63 3b 0d 0d 20 20 | 63 61 72 72 79 20 3d 20 |rec;.. |carry = |
|000025b0| 61 72 67 31 5b 30 5d 20 | 26 20 31 3b 0d 20 20 77 |arg1[0] |& 1;. w|
|000025c0| 68 69 6c 65 20 28 63 6f | 75 6e 74 20 3e 20 30 29 |hile (co|unt > 0)|
|000025d0| 0d 20 20 20 20 7b 0d 20 | 20 20 20 20 20 66 6f 72 |. {. | for|
|000025e0| 20 28 69 20 3d 20 37 3b | 20 69 20 3e 3d 20 30 3b | (i = 7;| i >= 0;|
|000025f0| 20 69 2d 2d 29 0d 09 7b | 0d 09 20 20 63 61 72 72 | i--)..{|.. carr|
|00002600| 79 20 3c 3c 3d 20 38 3b | 0d 09 20 20 63 61 72 72 |y <<= 8;|.. carr|
|00002610| 79 20 2b 3d 20 61 72 67 | 31 5b 69 5d 3b 0d 09 20 |y += arg|1[i];.. |
|00002620| 20 61 72 67 31 5b 69 5d | 20 3d 20 28 63 61 72 72 | arg1[i]| = (carr|
|00002630| 79 20 3e 3e 20 31 29 20 | 26 20 30 78 66 66 3b 0d |y >> 1) |& 0xff;.|
|00002640| 09 7d 0d 20 20 20 20 20 | 20 63 6f 75 6e 74 2d 2d |.}. | count--|
|00002650| 3b 0d 20 20 20 20 7d 0d | 0d 20 20 64 65 63 6f 64 |;. }.|. decod|
|00002660| 65 20 28 61 72 67 31 2c | 20 6c 76 2c 20 68 76 29 |e (arg1,| lv, hv)|
|00002670| 3b 0d 7d 0d 0c 0d 2f 2a | 20 44 69 76 69 64 65 20 |;.}.../*| Divide |
|00002680| 36 34 20 62 69 74 20 69 | 6e 74 65 67 65 72 20 4c |64 bit i|nteger L|
|00002690| 4e 55 4d 2c 20 48 4e 55 | 4d 20 62 79 20 36 34 20 |NUM, HNU|M by 64 |
|000026a0| 62 69 74 20 69 6e 74 65 | 67 65 72 20 4c 44 45 4e |bit inte|ger LDEN|
|000026b0| 2c 20 48 44 45 4e 0d 20 | 20 20 66 6f 72 20 61 20 |, HDEN. | for a |
|000026c0| 71 75 6f 74 69 65 6e 74 | 20 28 73 74 6f 72 65 64 |quotient| (stored|
|000026d0| 20 69 6e 20 2a 4c 51 55 | 4f 2c 20 2a 48 51 55 4f | in *LQU|O, *HQUO|
|000026e0| 29 20 61 6e 64 20 72 65 | 6d 61 69 6e 64 65 72 20 |) and re|mainder |
|000026f0| 28 69 6e 20 2a 4c 52 45 | 4d 2c 20 2a 48 52 45 4d |(in *LRE|M, *HREM|
|00002700| 29 2e 0d 20 20 20 43 4f | 44 45 20 69 73 20 61 20 |).. CO|DE is a |
|00002710| 74 72 65 65 20 63 6f 64 | 65 20 66 6f 72 20 61 20 |tree cod|e for a |
|00002720| 6b 69 6e 64 20 6f 66 20 | 64 69 76 69 73 69 6f 6e |kind of |division|
|00002730| 2c 20 6f 6e 65 20 6f 66 | 0d 20 20 20 54 52 55 4e |, one of|. TRUN|
|00002740| 43 5f 44 49 56 5f 45 58 | 50 52 2c 20 46 4c 4f 4f |C_DIV_EX|PR, FLOO|
|00002750| 52 5f 44 49 56 5f 45 58 | 50 52 2c 20 43 45 49 4c |R_DIV_EX|PR, CEIL|
|00002760| 5f 44 49 56 5f 45 58 50 | 52 2c 20 52 4f 55 4e 44 |_DIV_EXP|R, ROUND|
|00002770| 5f 44 49 56 5f 45 58 50 | 52 0d 20 20 20 6f 72 20 |_DIV_EXP|R. or |
|00002780| 45 58 41 43 54 5f 44 49 | 56 5f 45 58 50 52 0d 20 |EXACT_DI|V_EXPR. |
|00002790| 20 20 49 74 20 63 6f 6e | 74 72 6f 6c 73 20 68 6f | It con|trols ho|
|000027a0| 77 20 74 68 65 20 71 75 | 6f 74 69 65 6e 74 20 69 |w the qu|otient i|
|000027b0| 73 20 72 6f 75 6e 64 65 | 64 20 74 6f 20 61 20 69 |s rounde|d to a i|
|000027c0| 6e 74 65 67 65 72 2e 0d | 20 20 20 55 4e 53 20 6e |nteger..| UNS n|
|000027d0| 6f 6e 7a 65 72 6f 20 73 | 61 79 73 20 64 6f 20 75 |onzero s|ays do u|
|000027e0| 6e 73 69 67 6e 65 64 20 | 64 69 76 69 73 69 6f 6e |nsigned |division|
|000027f0| 2e 20 20 2a 2f 0d 0d 73 | 74 61 74 69 63 20 76 6f |. */..s|tatic vo|
|00002800| 69 64 0d 64 69 76 5f 61 | 6e 64 5f 72 6f 75 6e 64 |id.div_a|nd_round|
|00002810| 5f 64 6f 75 62 6c 65 20 | 28 63 6f 64 65 2c 20 75 |_double |(code, u|
|00002820| 6e 73 2c 0d 09 09 20 20 | 20 20 20 20 6c 6e 75 6d |ns,... | lnum|
|00002830| 5f 6f 72 69 67 2c 20 68 | 6e 75 6d 5f 6f 72 69 67 |_orig, h|num_orig|
|00002840| 2c 20 6c 64 65 6e 5f 6f | 72 69 67 2c 20 68 64 65 |, lden_o|rig, hde|
|00002850| 6e 5f 6f 72 69 67 2c 0d | 09 09 20 20 20 20 20 20 |n_orig,.|.. |
|00002860| 6c 71 75 6f 2c 20 68 71 | 75 6f 2c 20 6c 72 65 6d |lquo, hq|uo, lrem|
|00002870| 2c 20 68 72 65 6d 29 0d | 20 20 20 20 20 65 6e 75 |, hrem).| enu|
|00002880| 6d 20 74 72 65 65 5f 63 | 6f 64 65 20 63 6f 64 65 |m tree_c|ode code|
|00002890| 3b 0d 20 20 20 20 20 69 | 6e 74 20 75 6e 73 3b 0d |;. i|nt uns;.|
|000028a0| 20 20 20 20 20 69 6e 74 | 20 6c 6e 75 6d 5f 6f 72 | int| lnum_or|
|000028b0| 69 67 2c 20 68 6e 75 6d | 5f 6f 72 69 67 3b 09 09 |ig, hnum|_orig;..|
|000028c0| 2f 2a 20 6e 75 6d 20 3d | 3d 20 6e 75 6d 65 72 61 |/* num =|= numera|
|000028d0| 74 6f 72 20 3d 3d 20 64 | 69 76 69 64 65 6e 64 20 |tor == d|ividend |
|000028e0| 2a 2f 0d 20 20 20 20 20 | 69 6e 74 20 6c 64 65 6e |*/. |int lden|
|000028f0| 5f 6f 72 69 67 2c 20 68 | 64 65 6e 5f 6f 72 69 67 |_orig, h|den_orig|
|00002900| 3b 09 09 2f 2a 20 64 65 | 6e 20 3d 3d 20 64 65 6e |;../* de|n == den|
|00002910| 6f 6d 69 6e 61 74 6f 72 | 20 3d 3d 20 64 69 76 69 |ominator| == divi|
|00002920| 73 6f 72 20 2a 2f 0d 20 | 20 20 20 20 69 6e 74 20 |sor */. | int |
|00002930| 2a 6c 71 75 6f 2c 20 2a | 68 71 75 6f 2c 20 2a 6c |*lquo, *|hquo, *l|
|00002940| 72 65 6d 2c 20 2a 68 72 | 65 6d 3b 0d 7b 0d 20 20 |rem, *hr|em;.{. |
|00002950| 69 6e 74 20 71 75 6f 5f | 6e 65 67 20 3d 20 30 3b |int quo_|neg = 0;|
|00002960| 0d 20 20 73 68 6f 72 74 | 20 6e 75 6d 5b 39 5d 2c |. short| num[9],|
|00002970| 20 64 65 6e 5b 38 5d 2c | 20 71 75 6f 5b 38 5d 3b | den[8],| quo[8];|
|00002980| 09 2f 2a 20 65 78 74 72 | 61 20 65 6c 65 6d 65 6e |./* extr|a elemen|
|00002990| 74 20 66 6f 72 20 73 63 | 61 6c 69 6e 67 2e 20 20 |t for sc|aling. |
|000029a0| 2a 2f 0d 20 20 72 65 67 | 69 73 74 65 72 20 69 6e |*/. reg|ister in|
|000029b0| 74 20 69 2c 20 6a 2c 20 | 77 6f 72 6b 3b 0d 20 20 |t i, j, |work;. |
|000029c0| 72 65 67 69 73 74 65 72 | 20 69 6e 74 20 63 61 72 |register| int car|
|000029d0| 72 79 20 3d 20 30 3b 0d | 20 20 69 6e 74 20 6c 6e |ry = 0;.| int ln|
|000029e0| 75 6d 20 3d 20 6c 6e 75 | 6d 5f 6f 72 69 67 2c 20 |um = lnu|m_orig, |
|000029f0| 68 6e 75 6d 20 3d 20 68 | 6e 75 6d 5f 6f 72 69 67 |hnum = h|num_orig|
|00002a00| 3b 0d 20 20 69 6e 74 20 | 6c 64 65 6e 20 3d 20 6c |;. int |lden = l|
|00002a10| 64 65 6e 5f 6f 72 69 67 | 2c 20 68 64 65 6e 20 3d |den_orig|, hden =|
|00002a20| 20 68 64 65 6e 5f 6f 72 | 69 67 3b 0d 0d 20 20 69 | hden_or|ig;.. i|
|00002a30| 66 20 28 28 68 64 65 6e | 20 3d 3d 20 30 29 20 26 |f ((hden| == 0) &|
|00002a40| 26 20 28 6c 64 65 6e 20 | 3d 3d 20 30 29 29 0d 20 |& (lden |== 0)). |
|00002a50| 20 20 20 61 62 6f 72 74 | 20 28 29 3b 0d 0d 20 20 | abort| ();.. |
|00002a60| 2f 2a 20 63 61 6c 63 75 | 6c 61 74 65 20 71 75 6f |/* calcu|late quo|
|00002a70| 74 69 65 6e 74 20 73 69 | 67 6e 20 61 6e 64 20 63 |tient si|gn and c|
|00002a80| 6f 6e 76 65 72 74 20 6f | 70 65 72 61 6e 64 73 20 |onvert o|perands |
|00002a90| 74 6f 20 75 6e 73 69 67 | 6e 65 64 2e 20 20 2a 2f |to unsig|ned. */|
|00002aa0| 0d 20 20 69 66 20 28 21 | 75 6e 73 29 20 0d 20 20 |. if (!|uns) . |
|00002ab0| 20 20 7b 0d 20 20 20 20 | 20 20 69 66 20 28 68 64 | {. | if (hd|
|00002ac0| 65 6e 20 3c 20 30 29 20 | 0d 09 7b 0d 09 20 20 71 |en < 0) |..{.. q|
|00002ad0| 75 6f 5f 6e 65 67 20 3d | 20 7e 20 71 75 6f 5f 6e |uo_neg =| ~ quo_n|
|00002ae0| 65 67 3b 0d 09 20 20 6e | 65 67 5f 64 6f 75 62 6c |eg;.. n|eg_doubl|
|00002af0| 65 20 28 6c 64 65 6e 2c | 20 68 64 65 6e 2c 20 26 |e (lden,| hden, &|
|00002b00| 6c 64 65 6e 2c 20 26 68 | 64 65 6e 29 3b 0d 09 7d |lden, &h|den);..}|
|00002b10| 0d 20 20 20 20 20 20 69 | 66 20 28 68 6e 75 6d 20 |. i|f (hnum |
|00002b20| 3c 20 30 29 0d 09 7b 0d | 09 20 20 71 75 6f 5f 6e |< 0)..{.|. quo_n|
|00002b30| 65 67 20 3d 20 7e 20 71 | 75 6f 5f 6e 65 67 3b 0d |eg = ~ q|uo_neg;.|
|00002b40| 09 20 20 6e 65 67 5f 64 | 6f 75 62 6c 65 20 28 6c |. neg_d|ouble (l|
|00002b50| 6e 75 6d 2c 20 68 6e 75 | 6d 2c 20 26 6c 6e 75 6d |num, hnu|m, &lnum|
|00002b60| 2c 20 26 68 6e 75 6d 29 | 3b 0d 09 7d 0d 20 20 20 |, &hnum)|;..}. |
|00002b70| 20 7d 0d 0d 20 20 69 66 | 20 28 68 6e 75 6d 20 3d | }.. if| (hnum =|
|00002b80| 3d 20 30 20 26 26 20 68 | 64 65 6e 20 3d 3d 20 30 |= 0 && h|den == 0|
|00002b90| 29 0d 20 20 20 20 7b 09 | 09 09 09 2f 2a 20 73 69 |). {.|.../* si|
|00002ba0| 6e 67 6c 65 20 70 72 65 | 63 69 73 69 6f 6e 20 2a |ngle pre|cision *|
|00002bb0| 2f 0d 20 20 20 20 20 20 | 2a 68 71 75 6f 20 3d 20 |/. |*hquo = |
|00002bc0| 2a 68 72 65 6d 20 3d 20 | 30 3b 0d 20 20 20 20 20 |*hrem = |0;. |
|00002bd0| 20 2a 6c 71 75 6f 20 3d | 20 28 75 6e 73 69 67 6e | *lquo =| (unsign|
|00002be0| 65 64 29 20 6c 6e 75 6d | 20 2f 20 6c 64 65 6e 3b |ed) lnum| / lden;|
|00002bf0| 09 2f 2a 20 72 6f 75 6e | 64 73 20 74 6f 77 61 72 |./* roun|ds towar|
|00002c00| 64 20 7a 65 72 6f 20 73 | 69 6e 63 65 20 70 6f 73 |d zero s|ince pos|
|00002c10| 69 74 69 76 65 20 61 72 | 67 73 20 2a 2f 0d 20 20 |itive ar|gs */. |
|00002c20| 20 20 20 20 67 6f 74 6f | 20 66 69 6e 69 73 68 5f | goto| finish_|
|00002c30| 75 70 3b 0d 20 20 20 20 | 7d 0d 0d 20 20 69 66 20 |up;. |}.. if |
|00002c40| 28 68 6e 75 6d 20 3d 3d | 20 30 29 0d 20 20 20 20 |(hnum ==| 0). |
|00002c50| 7b 09 09 09 09 2f 2a 20 | 74 72 69 76 69 61 6c 20 |{..../* |trivial |
|00002c60| 63 61 73 65 3a 20 64 69 | 76 69 64 65 6e 64 20 3c |case: di|vidend <|
|00002c70| 20 64 69 76 69 73 6f 72 | 20 2a 2f 0d 20 20 20 20 | divisor| */. |
|00002c80| 20 20 2f 2a 20 68 64 65 | 6e 20 21 3d 20 30 20 61 | /* hde|n != 0 a|
|00002c90| 6c 72 65 61 64 79 20 63 | 68 65 63 6b 65 64 2e 20 |lready c|hecked. |
|00002ca0| 20 2a 2f 0d 20 20 20 20 | 20 20 2a 68 71 75 6f 20 | */. | *hquo |
|00002cb0| 3d 20 2a 6c 71 75 6f 20 | 3d 20 30 3b 0d 20 20 20 |= *lquo |= 0;. |
|00002cc0| 20 20 20 2a 68 72 65 6d | 20 3d 20 68 6e 75 6d 3b | *hrem| = hnum;|
|00002cd0| 0d 20 20 20 20 20 20 2a | 6c 72 65 6d 20 3d 20 6c |. *|lrem = l|
|00002ce0| 6e 75 6d 3b 0d 20 20 20 | 20 20 20 67 6f 74 6f 20 |num;. | goto |
|00002cf0| 66 69 6e 69 73 68 5f 75 | 70 3b 0d 20 20 20 20 7d |finish_u|p;. }|
|00002d00| 0d 0d 20 20 62 7a 65 72 | 6f 20 28 71 75 6f 2c 20 |.. bzer|o (quo, |
|00002d10| 73 69 7a 65 6f 66 20 71 | 75 6f 29 3b 0d 0d 20 20 |sizeof q|uo);.. |
|00002d20| 62 7a 65 72 6f 20 28 6e | 75 6d 2c 20 73 69 7a 65 |bzero (n|um, size|
|00002d30| 6f 66 20 6e 75 6d 29 3b | 09 2f 2a 20 74 6f 20 7a |of num);|./* to z|
|00002d40| 65 72 6f 20 39 74 68 20 | 65 6c 65 6d 65 6e 74 20 |ero 9th |element |
|00002d50| 2a 2f 0d 20 20 62 7a 65 | 72 6f 20 28 64 65 6e 2c |*/. bze|ro (den,|
|00002d60| 20 73 69 7a 65 6f 66 20 | 64 65 6e 29 3b 0d 0d 20 | sizeof |den);.. |
|00002d70| 20 65 6e 63 6f 64 65 20 | 28 6e 75 6d 2c 20 6c 6e | encode |(num, ln|
|00002d80| 75 6d 2c 20 68 6e 75 6d | 29 3b 20 0d 20 20 65 6e |um, hnum|); . en|
|00002d90| 63 6f 64 65 20 28 64 65 | 6e 2c 20 6c 64 65 6e 2c |code (de|n, lden,|
|00002da0| 20 68 64 65 6e 29 3b 0d | 0d 20 20 69 66 20 28 68 | hden);.|. if (h|
|00002db0| 64 65 6e 20 3d 3d 20 30 | 29 0d 20 20 20 20 7b 09 |den == 0|). {.|
|00002dc0| 09 09 09 2f 2a 20 73 69 | 6d 70 6c 65 72 20 61 6c |.../* si|mpler al|
|00002dd0| 67 6f 72 69 74 68 6d 20 | 2a 2f 0d 20 20 20 20 20 |gorithm |*/. |
|00002de0| 20 2f 2a 20 68 6e 75 6d | 20 21 3d 20 30 20 61 6c | /* hnum| != 0 al|
|00002df0| 72 65 61 64 79 20 63 68 | 65 63 6b 65 64 2e 20 20 |ready ch|ecked. |
|00002e00| 2a 2f 0d 20 20 20 20 20 | 20 66 6f 72 20 28 69 20 |*/. | for (i |
|00002e10| 3d 20 37 3b 20 69 20 3e | 3d 20 30 3b 20 69 2d 2d |= 7; i >|= 0; i--|
|00002e20| 29 0d 09 7b 0d 09 20 20 | 77 6f 72 6b 20 3d 20 6e |)..{.. |work = n|
|00002e30| 75 6d 5b 69 5d 20 2b 20 | 28 63 61 72 72 79 20 3c |um[i] + |(carry <|
|00002e40| 3c 20 38 29 3b 0d 09 20 | 20 71 75 6f 5b 69 5d 20 |< 8);.. | quo[i] |
|00002e50| 3d 20 77 6f 72 6b 20 2f | 20 6c 64 65 6e 3b 0d 09 |= work /| lden;..|
|00002e60| 20 20 63 61 72 72 79 20 | 3d 20 77 6f 72 6b 20 25 | carry |= work %|
|00002e70| 20 6c 64 65 6e 3b 0d 09 | 7d 0d 20 20 20 20 7d 0d | lden;..|}. }.|
|00002e80| 20 20 65 6c 73 65 20 7b | 09 09 09 2f 2a 20 66 75 | else {|.../* fu|
|00002e90| 6c 6c 20 64 6f 75 62 6c | 65 20 70 72 65 63 69 73 |ll doubl|e precis|
|00002ea0| 69 6f 6e 2c 0d 09 09 09 | 09 20 20 20 77 69 74 68 |ion,....|. with|
|00002eb0| 20 74 68 61 6e 6b 73 20 | 74 6f 20 44 6f 6e 20 4b | thanks |to Don K|
|00002ec0| 6e 75 74 68 27 73 0d 09 | 09 09 09 20 20 20 22 53 |nuth's..|... "S|
|00002ed0| 65 6d 69 2d 4e 75 6d 65 | 72 69 63 69 61 6c 20 41 |emi-Nume|ricial A|
|00002ee0| 6c 67 6f 72 69 74 68 6d | 73 22 2e 20 20 2a 2f 0d |lgorithm|s". */.|
|00002ef0| 23 64 65 66 69 6e 65 20 | 42 41 53 45 20 32 35 36 |#define |BASE 256|
|00002f00| 0d 20 20 20 20 69 6e 74 | 20 71 75 6f 5f 65 73 74 |. int| quo_est|
|00002f10| 2c 20 73 63 61 6c 65 2c | 20 6e 75 6d 5f 68 69 5f |, scale,| num_hi_|
|00002f20| 73 69 67 2c 20 64 65 6e | 5f 68 69 5f 73 69 67 2c |sig, den|_hi_sig,|
|00002f30| 20 71 75 6f 5f 68 69 5f | 73 69 67 3b 0d 0d 20 20 | quo_hi_|sig;.. |
|00002f40| 20 20 2f 2a 20 46 69 6e | 64 20 74 68 65 20 68 69 | /* Fin|d the hi|
|00002f50| 67 68 65 73 74 20 6e 6f | 6e 2d 7a 65 72 6f 20 64 |ghest no|n-zero d|
|00002f60| 69 76 69 73 6f 72 20 64 | 69 67 69 74 2e 20 20 2a |ivisor d|igit. *|
|00002f70| 2f 0d 20 20 20 20 66 6f | 72 20 28 69 20 3d 20 37 |/. fo|r (i = 7|
|00002f80| 3b 20 3b 20 69 2d 2d 29 | 0d 20 20 20 20 20 20 69 |; ; i--)|. i|
|00002f90| 66 20 28 64 65 6e 5b 69 | 5d 20 21 3d 20 30 29 20 |f (den[i|] != 0) |
|00002fa0| 7b 0d 09 64 65 6e 5f 68 | 69 5f 73 69 67 20 3d 20 |{..den_h|i_sig = |
|00002fb0| 69 3b 0d 09 62 72 65 61 | 6b 3b 0d 20 20 20 20 20 |i;..brea|k;. |
|00002fc0| 20 7d 0d 20 20 20 20 66 | 6f 72 20 28 69 20 3d 20 | }. f|or (i = |
|00002fd0| 37 3b 20 3b 20 69 2d 2d | 29 0d 20 20 20 20 20 20 |7; ; i--|). |
|00002fe0| 69 66 20 28 6e 75 6d 5b | 69 5d 20 21 3d 20 30 29 |if (num[|i] != 0)|
|00002ff0| 20 7b 0d 09 6e 75 6d 5f | 68 69 5f 73 69 67 20 3d | {..num_|hi_sig =|
|00003000| 20 69 3b 0d 09 62 72 65 | 61 6b 3b 0d 20 20 20 20 | i;..bre|ak;. |
|00003010| 20 20 7d 0d 20 20 20 20 | 71 75 6f 5f 68 69 5f 73 | }. |quo_hi_s|
|00003020| 69 67 20 3d 20 6e 75 6d | 5f 68 69 5f 73 69 67 20 |ig = num|_hi_sig |
|00003030| 2d 20 64 65 6e 5f 68 69 | 5f 73 69 67 20 2b 20 31 |- den_hi|_sig + 1|
|00003040| 3b 0d 0d 20 20 20 20 2f | 2a 20 49 6e 73 75 72 65 |;.. /|* Insure|
|00003050| 20 74 68 61 74 20 74 68 | 65 20 66 69 72 73 74 20 | that th|e first |
|00003060| 64 69 67 69 74 20 6f 66 | 20 74 68 65 20 64 69 76 |digit of| the div|
|00003070| 69 73 6f 72 20 69 73 20 | 61 74 20 6c 65 61 73 74 |isor is |at least|
|00003080| 20 42 41 53 45 2f 32 2e | 0d 20 20 20 20 20 20 20 | BASE/2.|. |
|00003090| 54 68 69 73 20 69 73 20 | 72 65 71 75 69 72 65 64 |This is |required|
|000030a0| 20 62 79 20 74 68 65 20 | 71 75 6f 74 69 65 6e 74 | by the |quotient|
|000030b0| 20 64 69 67 69 74 20 65 | 73 74 69 6d 61 74 69 6f | digit e|stimatio|
|000030c0| 6e 20 61 6c 67 6f 72 69 | 74 68 6d 2e 20 20 2a 2f |n algori|thm. */|
|000030d0| 0d 0d 20 20 20 20 73 63 | 61 6c 65 20 3d 20 42 41 |.. sc|ale = BA|
|000030e0| 53 45 20 2f 20 28 64 65 | 6e 5b 64 65 6e 5f 68 69 |SE / (de|n[den_hi|
|000030f0| 5f 73 69 67 5d 20 2b 20 | 31 29 3b 0d 20 20 20 20 |_sig] + |1);. |
|00003100| 69 66 20 28 73 63 61 6c | 65 20 3e 20 31 29 20 7b |if (scal|e > 1) {|
|00003110| 09 09 2f 2a 20 73 63 61 | 6c 65 20 64 69 76 69 73 |../* sca|le divis|
|00003120| 6f 72 20 61 6e 64 20 64 | 69 76 69 64 65 6e 64 20 |or and d|ividend |
|00003130| 2a 2f 0d 20 20 20 20 20 | 20 63 61 72 72 79 20 3d |*/. | carry =|
|00003140| 20 30 3b 0d 20 20 20 20 | 20 20 66 6f 72 20 28 69 | 0;. | for (i|
|00003150| 20 3d 20 30 3b 20 69 20 | 3c 3d 20 38 3b 20 69 2b | = 0; i |<= 8; i+|
|00003160| 2b 29 20 7b 0d 09 77 6f | 72 6b 20 3d 20 28 6e 75 |+) {..wo|rk = (nu|
|00003170| 6d 5b 69 5d 20 2a 20 73 | 63 61 6c 65 29 20 2b 20 |m[i] * s|cale) + |
|00003180| 63 61 72 72 79 3b 0d 09 | 6e 75 6d 5b 69 5d 20 3d |carry;..|num[i] =|
|00003190| 20 77 6f 72 6b 20 26 20 | 30 78 66 66 3b 0d 09 63 | work & |0xff;..c|
|000031a0| 61 72 72 79 20 3d 20 77 | 6f 72 6b 20 3e 3e 20 38 |arry = w|ork >> 8|
|000031b0| 3b 0d 09 69 66 20 28 6e | 75 6d 5b 69 5d 20 21 3d |;..if (n|um[i] !=|
|000031c0| 20 30 29 20 6e 75 6d 5f | 68 69 5f 73 69 67 20 3d | 0) num_|hi_sig =|
|000031d0| 20 69 3b 0d 20 20 20 20 | 20 20 7d 0d 20 20 20 20 | i;. | }. |
|000031e0| 20 20 63 61 72 72 79 20 | 3d 20 30 3b 0d 20 20 20 | carry |= 0;. |
|000031f0| 20 20 20 66 6f 72 20 28 | 69 20 3d 20 30 3b 20 69 | for (|i = 0; i|
|00003200| 20 3c 3d 20 37 3b 20 69 | 2b 2b 29 20 7b 0d 09 77 | <= 7; i|++) {..w|
|00003210| 6f 72 6b 20 3d 20 28 64 | 65 6e 5b 69 5d 20 2a 20 |ork = (d|en[i] * |
|00003220| 73 63 61 6c 65 29 20 2b | 20 63 61 72 72 79 3b 0d |scale) +| carry;.|
|00003230| 09 64 65 6e 5b 69 5d 20 | 3d 20 77 6f 72 6b 20 26 |.den[i] |= work &|
|00003240| 20 30 78 66 66 3b 0d 09 | 63 61 72 72 79 20 3d 20 | 0xff;..|carry = |
|00003250| 77 6f 72 6b 20 3e 3e 20 | 38 3b 0d 09 69 66 20 28 |work >> |8;..if (|
|00003260| 64 65 6e 5b 69 5d 20 21 | 3d 20 30 29 20 64 65 6e |den[i] !|= 0) den|
|00003270| 5f 68 69 5f 73 69 67 20 | 3d 20 69 3b 0d 20 20 20 |_hi_sig |= i;. |
|00003280| 20 20 20 7d 0d 20 20 20 | 20 7d 0d 0d 20 20 20 20 | }. | }.. |
|00003290| 2f 2a 20 4d 61 69 6e 20 | 6c 6f 6f 70 20 2a 2f 0d |/* Main |loop */.|
|000032a0| 20 20 20 20 66 6f 72 20 | 28 69 20 3d 20 71 75 6f | for |(i = quo|
|000032b0| 5f 68 69 5f 73 69 67 3b | 20 69 20 3e 20 30 3b 20 |_hi_sig;| i > 0; |
|000032c0| 69 2d 2d 29 20 7b 0d 20 | 20 20 20 20 20 2f 2a 20 |i--) {. | /* |
|000032d0| 71 75 65 73 73 20 74 68 | 65 20 6e 65 78 74 20 71 |quess th|e next q|
|000032e0| 75 6f 74 69 65 6e 74 20 | 64 69 67 69 74 2c 20 71 |uotient |digit, q|
|000032f0| 75 6f 5f 65 73 74 2c 20 | 62 79 20 64 69 76 69 64 |uo_est, |by divid|
|00003300| 69 6e 67 20 74 68 65 20 | 66 69 72 73 74 0d 09 20 |ing the |first.. |
|00003310| 74 77 6f 20 72 65 6d 61 | 69 6e 69 6e 67 20 64 69 |two rema|ining di|
|00003320| 76 69 64 65 6e 64 20 64 | 69 67 69 74 73 20 62 79 |vidend d|igits by|
|00003330| 20 74 68 65 20 68 69 67 | 68 20 6f 72 64 65 72 20 | the hig|h order |
|00003340| 71 75 6f 74 69 65 6e 74 | 20 64 69 67 69 74 2e 0d |quotient| digit..|
|00003350| 09 20 71 75 6f 5f 65 73 | 74 20 69 73 20 6e 65 76 |. quo_es|t is nev|
|00003360| 65 72 20 6c 6f 77 20 61 | 6e 64 20 69 73 20 61 74 |er low a|nd is at|
|00003370| 20 6d 6f 73 74 20 32 20 | 68 69 67 68 2e 20 20 2a | most 2 |high. *|
|00003380| 2f 0d 0d 20 20 20 20 20 | 20 69 6e 74 20 6e 75 6d |/.. | int num|
|00003390| 5f 68 69 3b 09 09 2f 2a | 20 69 6e 64 65 78 20 6f |_hi;../*| index o|
|000033a0| 66 20 68 69 67 68 65 73 | 74 20 72 65 6d 61 69 6e |f highes|t remain|
|000033b0| 69 6e 67 20 64 69 76 69 | 64 65 6e 64 20 64 69 67 |ing divi|dend dig|
|000033c0| 69 74 20 2a 2f 0d 0d 20 | 20 20 20 20 20 6e 75 6d |it */.. | num|
|000033d0| 5f 68 69 20 3d 20 69 20 | 2b 20 64 65 6e 5f 68 69 |_hi = i |+ den_hi|
|000033e0| 5f 73 69 67 3b 0d 0d 20 | 20 20 20 20 20 77 6f 72 |_sig;.. | wor|
|000033f0| 6b 20 3d 20 28 6e 75 6d | 5b 6e 75 6d 5f 68 69 5d |k = (num|[num_hi]|
|00003400| 20 2a 20 42 41 53 45 29 | 20 2b 20 28 6e 75 6d 5f | * BASE)| + (num_|
|00003410| 68 69 20 3f 20 30 20 3a | 20 6e 75 6d 5b 6e 75 6d |hi ? 0 :| num[num|
|00003420| 5f 68 69 20 2d 20 31 5d | 29 3b 0d 20 20 20 20 20 |_hi - 1]|);. |
|00003430| 20 69 66 20 28 6e 75 6d | 5b 6e 75 6d 5f 68 69 5d | if (num|[num_hi]|
|00003440| 20 21 3d 20 64 65 6e 5b | 64 65 6e 5f 68 69 5f 73 | != den[|den_hi_s|
|00003450| 69 67 5d 29 20 7b 0d 09 | 71 75 6f 5f 65 73 74 20 |ig]) {..|quo_est |
|00003460| 3d 20 77 6f 72 6b 20 2f | 20 64 65 6e 5b 64 65 6e |= work /| den[den|
|00003470| 5f 68 69 5f 73 69 67 5d | 3b 0d 20 20 20 20 20 20 |_hi_sig]|;. |
|00003480| 7d 0d 20 20 20 20 20 20 | 65 6c 73 65 20 7b 0d 09 |}. |else {..|
|00003490| 71 75 6f 5f 65 73 74 20 | 3d 20 42 41 53 45 20 2d |quo_est |= BASE -|
|000034a0| 20 31 3b 0d 20 20 20 20 | 20 20 7d 0d 0d 20 20 20 | 1;. | }.. |
|000034b0| 20 20 20 2f 2a 20 72 65 | 66 69 6e 65 20 71 75 6f | /* re|fine quo|
|000034c0| 5f 65 73 74 20 73 6f 20 | 69 74 27 73 20 75 73 75 |_est so |it's usu|
|000034d0| 61 6c 6c 79 20 63 6f 72 | 72 65 63 74 2c 20 61 6e |ally cor|rect, an|
|000034e0| 64 20 61 74 20 6d 6f 73 | 74 20 6f 6e 65 20 68 69 |d at mos|t one hi|
|000034f0| 67 68 2e 20 20 20 2a 2f | 0d 20 20 20 20 20 20 77 |gh. */|. w|
|00003500| 68 69 6c 65 20 28 28 64 | 65 6e 5b 64 65 6e 5f 68 |hile ((d|en[den_h|
|00003510| 69 5f 73 69 67 20 2d 20 | 31 5d 20 2a 20 71 75 6f |i_sig - |1] * quo|
|00003520| 5f 65 73 74 29 0d 09 20 | 20 20 20 20 3e 20 28 28 |_est).. | > ((|
|00003530| 28 77 6f 72 6b 20 2d 20 | 28 71 75 6f 5f 65 73 74 |(work - |(quo_est|
|00003540| 20 2a 20 64 65 6e 5b 64 | 65 6e 5f 68 69 5f 73 69 | * den[d|en_hi_si|
|00003550| 67 5d 29 29 20 2a 20 42 | 41 53 45 29 0d 09 09 20 |g])) * B|ASE)... |
|00003560| 2b 20 28 28 6e 75 6d 5f | 68 69 20 2d 20 31 29 20 |+ ((num_|hi - 1) |
|00003570| 3f 20 30 20 3a 20 6e 75 | 6d 5b 6e 75 6d 5f 68 69 |? 0 : nu|m[num_hi|
|00003580| 20 2d 20 32 5d 29 29 29 | 20 7b 0d 09 71 75 6f 5f | - 2])))| {..quo_|
|00003590| 65 73 74 2d 2d 3b 0d 20 | 20 20 20 20 20 7d 0d 0d |est--;. | }..|
|000035a0| 20 20 20 20 20 20 2f 2a | 20 74 72 79 20 71 75 6f | /*| try quo|
|000035b0| 5f 65 73 74 20 61 73 20 | 74 68 65 20 71 75 6f 74 |_est as |the quot|
|000035c0| 69 65 6e 74 20 64 69 67 | 69 74 2c 20 62 79 20 6d |ient dig|it, by m|
|000035d0| 75 6c 74 69 70 6c 79 69 | 6e 67 20 74 68 65 0d 20 |ultiplyi|ng the. |
|000035e0| 20 20 20 20 20 20 20 20 | 64 69 76 69 73 6f 72 20 | |divisor |
|000035f0| 62 79 20 71 75 6f 5f 65 | 73 74 20 61 6e 64 20 73 |by quo_e|st and s|
|00003600| 75 62 74 72 61 63 74 69 | 6e 67 20 66 72 6f 6d 20 |ubtracti|ng from |
|00003610| 74 68 65 20 72 65 6d 61 | 69 6e 69 6e 67 20 64 69 |the rema|ining di|
|00003620| 76 69 64 65 6e 64 2e 20 | 20 2a 2f 0d 0d 20 20 20 |vidend. | */.. |
|00003630| 20 20 20 63 61 72 72 79 | 20 3d 20 30 3b 0d 0d 20 | carry| = 0;.. |
|00003640| 20 20 20 20 20 66 6f 72 | 20 28 6a 20 3d 20 30 3b | for| (j = 0;|
|00003650| 20 6a 20 3c 3d 20 64 65 | 6e 5f 68 69 5f 73 69 67 | j <= de|n_hi_sig|
|00003660| 3b 20 6a 2b 2b 29 20 7b | 0d 09 69 6e 74 20 64 69 |; j++) {|..int di|
|00003670| 67 69 74 3b 0d 0d 09 77 | 6f 72 6b 20 3d 20 6e 75 |git;...w|ork = nu|
|00003680| 6d 5b 69 20 2b 20 6a 5d | 20 2d 20 28 71 75 6f 5f |m[i + j]| - (quo_|
|00003690| 65 73 74 20 2a 20 64 65 | 6e 5b 6a 5d 29 20 2b 20 |est * de|n[j]) + |
|000036a0| 63 61 72 72 79 3b 0d 09 | 64 69 67 69 74 20 3d 20 |carry;..|digit = |
|000036b0| 77 6f 72 6b 20 26 20 30 | 78 66 66 3b 0d 09 63 61 |work & 0|xff;..ca|
|000036c0| 72 72 79 20 3d 20 77 6f | 72 6b 20 3e 3e 20 38 3b |rry = wo|rk >> 8;|
|000036d0| 0d 09 69 66 20 28 64 69 | 67 69 74 20 3c 20 30 29 |..if (di|git < 0)|
|000036e0| 20 7b 0d 09 20 20 64 69 | 67 69 74 20 2b 3d 20 42 | {.. di|git += B|
|000036f0| 41 53 45 3b 0d 09 20 20 | 63 61 72 72 79 2d 2d 3b |ASE;.. |carry--;|
|00003700| 0d 09 7d 0d 09 6e 75 6d | 5b 69 20 2b 20 6a 5d 20 |..}..num|[i + j] |
|00003710| 3d 20 64 69 67 69 74 3b | 0d 20 20 20 20 20 20 7d |= digit;|. }|
|00003720| 0d 0d 20 20 20 20 20 20 | 2f 2a 20 69 66 20 71 75 |.. |/* if qu|
|00003730| 6f 5f 65 73 74 20 77 61 | 73 20 68 69 67 68 20 62 |o_est wa|s high b|
|00003740| 79 20 6f 6e 65 2c 20 74 | 68 65 6e 20 6e 75 6d 5b |y one, t|hen num[|
|00003750| 69 5d 20 77 65 6e 74 20 | 6e 65 67 61 74 69 76 65 |i] went |negative|
|00003760| 20 61 6e 64 0d 09 20 77 | 65 20 6e 65 65 64 20 74 | and.. w|e need t|
|00003770| 6f 20 63 6f 72 72 65 63 | 74 20 74 68 69 6e 67 73 |o correc|t things|
|00003780| 2e 20 20 2a 2f 0d 0d 20 | 20 20 20 20 20 69 66 20 |. */.. | if |
|00003790| 28 6e 75 6d 5b 6e 75 6d | 5f 68 69 5d 20 3c 20 30 |(num[num|_hi] < 0|
|000037a0| 29 20 7b 0d 09 71 75 6f | 5f 65 73 74 2d 2d 3b 0d |) {..quo|_est--;.|
|000037b0| 09 63 61 72 72 79 20 3d | 20 30 3b 09 09 2f 2a 20 |.carry =| 0;../* |
|000037c0| 61 64 64 20 64 69 76 69 | 73 6f 72 20 62 61 63 6b |add divi|sor back|
|000037d0| 20 69 6e 20 2a 2f 0d 09 | 66 6f 72 20 28 6a 20 3d | in */..|for (j =|
|000037e0| 20 30 3b 20 6a 20 3c 3d | 20 64 65 6e 5f 68 69 5f | 0; j <=| den_hi_|
|000037f0| 73 69 67 3b 20 6a 2b 2b | 29 20 7b 0d 09 20 20 77 |sig; j++|) {.. w|
|00003800| 6f 72 6b 20 3d 20 6e 75 | 6d 5b 69 20 2b 20 6a 5d |ork = nu|m[i + j]|
|00003810| 20 2b 20 64 65 6e 5b 6a | 5d 20 2b 20 63 61 72 72 | + den[j|] + carr|
|00003820| 79 3b 0d 09 20 20 69 66 | 20 28 77 6f 72 6b 20 3e |y;.. if| (work >|
|00003830| 20 42 41 53 45 29 20 7b | 0d 09 20 20 20 20 77 6f | BASE) {|.. wo|
|00003840| 72 6b 20 2d 3d 20 42 41 | 53 45 3b 0d 09 20 20 20 |rk -= BA|SE;.. |
|00003850| 20 63 61 72 72 79 20 3d | 20 31 3b 0d 09 20 20 7d | carry =| 1;.. }|
|00003860| 0d 09 20 20 65 6c 73 65 | 20 7b 0d 09 20 20 20 20 |.. else| {.. |
|00003870| 63 61 72 72 79 20 3d 20 | 30 3b 0d 09 20 20 7d 0d |carry = |0;.. }.|
|00003880| 09 20 20 6e 75 6d 5b 69 | 20 2b 20 6a 5d 20 3d 20 |. num[i| + j] = |
|00003890| 77 6f 72 6b 3b 0d 09 7d | 0d 09 6e 75 6d 20 5b 6e |work;..}|..num [n|
|000038a0| 75 6d 5f 68 69 5d 20 2b | 3d 20 63 61 72 72 79 3b |um_hi] +|= carry;|
|000038b0| 0d 20 20 20 20 20 20 7d | 0d 0d 20 20 20 20 20 20 |. }|.. |
|000038c0| 2f 2a 20 73 74 6f 72 65 | 20 74 68 65 20 71 75 6f |/* store| the quo|
|000038d0| 74 69 65 6e 74 20 64 69 | 67 69 74 2e 20 20 2a 2f |tient di|git. */|
|000038e0| 0d 20 20 20 20 20 20 71 | 75 6f 5b 69 20 2d 20 31 |. q|uo[i - 1|
|000038f0| 5d 20 3d 20 71 75 6f 5f | 65 73 74 3b 0d 20 20 20 |] = quo_|est;. |
|00003900| 20 7d 0d 20 20 7d 0d 0d | 20 20 64 65 63 6f 64 65 | }. }..| decode|
|00003910| 20 28 71 75 6f 2c 20 6c | 71 75 6f 2c 20 68 71 75 | (quo, l|quo, hqu|
|00003920| 6f 29 3b 0d 0d 20 66 69 | 6e 69 73 68 5f 75 70 3a |o);.. fi|nish_up:|
|00003930| 0d 20 20 2f 2a 20 69 66 | 20 72 65 73 75 6c 74 20 |. /* if| result |
|00003940| 69 73 20 6e 65 67 61 74 | 69 76 65 2c 20 6d 61 6b |is negat|ive, mak|
|00003950| 65 20 69 74 20 73 6f 2e | 20 20 2a 2f 0d 20 20 69 |e it so.| */. i|
|00003960| 66 20 28 71 75 6f 5f 6e | 65 67 29 0d 20 20 20 20 |f (quo_n|eg). |
|00003970| 6e 65 67 5f 64 6f 75 62 | 6c 65 20 28 2a 6c 71 75 |neg_doub|le (*lqu|
|00003980| 6f 2c 20 2a 68 71 75 6f | 2c 20 6c 71 75 6f 2c 20 |o, *hquo|, lquo, |
|00003990| 68 71 75 6f 29 3b 0d 0d | 20 20 2f 2a 20 63 6f 6d |hquo);..| /* com|
|000039a0| 70 75 74 65 20 74 72 69 | 61 6c 20 72 65 6d 61 69 |pute tri|al remai|
|000039b0| 6e 64 65 72 3a 20 20 72 | 65 6d 20 3d 20 6e 75 6d |nder: r|em = num|
|000039c0| 20 2d 20 28 71 75 6f 20 | 2a 20 64 65 6e 29 20 20 | - (quo |* den) |
|000039d0| 2a 2f 0d 20 20 6d 75 6c | 5f 64 6f 75 62 6c 65 20 |*/. mul|_double |
|000039e0| 28 2a 6c 71 75 6f 2c 20 | 2a 68 71 75 6f 2c 20 6c |(*lquo, |*hquo, l|
|000039f0| 64 65 6e 5f 6f 72 69 67 | 2c 20 68 64 65 6e 5f 6f |den_orig|, hden_o|
|00003a00| 72 69 67 2c 20 6c 72 65 | 6d 2c 20 68 72 65 6d 29 |rig, lre|m, hrem)|
|00003a10| 3b 0d 20 20 6e 65 67 5f | 64 6f 75 62 6c 65 20 28 |;. neg_|double (|
|00003a20| 2a 6c 72 65 6d 2c 20 2a | 68 72 65 6d 2c 20 6c 72 |*lrem, *|hrem, lr|
|00003a30| 65 6d 2c 20 68 72 65 6d | 29 3b 0d 20 20 61 64 64 |em, hrem|);. add|
|00003a40| 5f 64 6f 75 62 6c 65 20 | 28 6c 6e 75 6d 5f 6f 72 |_double |(lnum_or|
|00003a50| 69 67 2c 20 68 6e 75 6d | 5f 6f 72 69 67 2c 20 2a |ig, hnum|_orig, *|
|00003a60| 6c 72 65 6d 2c 20 2a 68 | 72 65 6d 2c 20 6c 72 65 |lrem, *h|rem, lre|
|00003a70| 6d 2c 20 68 72 65 6d 29 | 3b 0d 0d 20 20 73 77 69 |m, hrem)|;.. swi|
|00003a80| 74 63 68 20 28 63 6f 64 | 65 29 0d 20 20 20 20 7b |tch (cod|e). {|
|00003a90| 0d 20 20 20 20 63 61 73 | 65 20 54 52 55 4e 43 5f |. cas|e TRUNC_|
|00003aa0| 44 49 56 5f 45 58 50 52 | 3a 0d 20 20 20 20 63 61 |DIV_EXPR|:. ca|
|00003ab0| 73 65 20 54 52 55 4e 43 | 5f 4d 4f 44 5f 45 58 50 |se TRUNC|_MOD_EXP|
|00003ac0| 52 3a 09 2f 2a 20 72 6f | 75 6e 64 20 74 6f 77 61 |R:./* ro|und towa|
|00003ad0| 72 64 20 7a 65 72 6f 20 | 2a 2f 0d 20 20 20 20 63 |rd zero |*/. c|
|00003ae0| 61 73 65 20 45 58 41 43 | 54 5f 44 49 56 5f 45 58 |ase EXAC|T_DIV_EX|
|00003af0| 50 52 3a 09 2f 2a 20 66 | 6f 72 20 74 68 69 73 20 |PR:./* f|or this |
|00003b00| 6f 6e 65 2c 20 69 74 20 | 73 68 6f 75 6c 64 6e 27 |one, it |shouldn'|
|00003b10| 74 20 6d 61 74 74 65 72 | 20 2a 2f 0d 20 20 20 20 |t matter| */. |
|00003b20| 20 20 72 65 74 75 72 6e | 3b 0d 0d 20 20 20 20 63 | return|;.. c|
|00003b30| 61 73 65 20 46 4c 4f 4f | 52 5f 44 49 56 5f 45 58 |ase FLOO|R_DIV_EX|
|00003b40| 50 52 3a 0d 20 20 20 20 | 63 61 73 65 20 46 4c 4f |PR:. |case FLO|
|00003b50| 4f 52 5f 4d 4f 44 5f 45 | 58 50 52 3a 09 2f 2a 20 |OR_MOD_E|XPR:./* |
|00003b60| 72 6f 75 6e 64 20 74 6f | 77 61 72 64 20 6e 65 67 |round to|ward neg|
|00003b70| 61 74 69 76 65 20 69 6e | 66 69 6e 69 74 79 20 2a |ative in|finity *|
|00003b80| 2f 0d 20 20 20 20 20 20 | 69 66 20 28 71 75 6f 5f |/. |if (quo_|
|00003b90| 6e 65 67 20 26 26 20 28 | 2a 6c 72 65 6d 20 21 3d |neg && (|*lrem !=|
|00003ba0| 20 30 20 7c 7c 20 2a 68 | 72 65 6d 20 21 3d 20 30 | 0 || *h|rem != 0|
|00003bb0| 29 29 20 20 20 2f 2a 20 | 72 61 74 69 6f 20 3c 20 |)) /* |ratio < |
|00003bc0| 30 20 26 26 20 72 65 6d | 20 21 3d 20 30 20 2a 2f |0 && rem| != 0 */|
|00003bd0| 0d 09 7b 0d 09 20 20 2f | 2a 20 71 75 6f 20 3d 20 |..{.. /|* quo = |
|00003be0| 71 75 6f 20 2d 20 31 3b | 20 20 2a 2f 0d 09 20 20 |quo - 1;| */.. |
|00003bf0| 61 64 64 5f 64 6f 75 62 | 6c 65 20 28 2a 6c 71 75 |add_doub|le (*lqu|
|00003c00| 6f 2c 20 2a 68 71 75 6f | 2c 20 2d 31 2c 20 2d 31 |o, *hquo|, -1, -1|
|00003c10| 2c 20 6c 71 75 6f 2c 20 | 68 71 75 6f 29 3b 0d 09 |, lquo, |hquo);..|
|00003c20| 7d 0d 20 20 20 20 20 20 | 65 6c 73 65 20 72 65 74 |}. |else ret|
|00003c30| 75 72 6e 3b 0d 20 20 20 | 20 20 20 62 72 65 61 6b |urn;. | break|
|00003c40| 3b 0d 0d 20 20 20 20 63 | 61 73 65 20 43 45 49 4c |;.. c|ase CEIL|
|00003c50| 5f 44 49 56 5f 45 58 50 | 52 3a 0d 20 20 20 20 63 |_DIV_EXP|R:. c|
|00003c60| 61 73 65 20 43 45 49 4c | 5f 4d 4f 44 5f 45 58 50 |ase CEIL|_MOD_EXP|
|00003c70| 52 3a 09 09 2f 2a 20 72 | 6f 75 6e 64 20 74 6f 77 |R:../* r|ound tow|
|00003c80| 61 72 64 20 70 6f 73 69 | 74 69 76 65 20 69 6e 66 |ard posi|tive inf|
|00003c90| 69 6e 69 74 79 20 2a 2f | 0d 20 20 20 20 20 20 69 |inity */|. i|
|00003ca0| 66 20 28 21 71 75 6f 5f | 6e 65 67 20 26 26 20 28 |f (!quo_|neg && (|
|00003cb0| 2a 6c 72 65 6d 20 21 3d | 20 30 20 7c 7c 20 2a 68 |*lrem !=| 0 || *h|
|00003cc0| 72 65 6d 20 21 3d 20 30 | 29 29 20 20 2f 2a 20 72 |rem != 0|)) /* r|
|00003cd0| 61 74 69 6f 20 3e 20 30 | 20 26 26 20 72 65 6d 20 |atio > 0| && rem |
|00003ce0| 21 3d 20 30 20 2a 2f 0d | 09 7b 0d 09 20 20 61 64 |!= 0 */.|.{.. ad|
|00003cf0| 64 5f 64 6f 75 62 6c 65 | 20 28 2a 6c 71 75 6f 2c |d_double| (*lquo,|
|00003d00| 20 2a 68 71 75 6f 2c 20 | 31 2c 20 30 2c 20 6c 71 | *hquo, |1, 0, lq|
|00003d10| 75 6f 2c 20 68 71 75 6f | 29 3b 0d 09 7d 0d 20 20 |uo, hquo|);..}. |
|00003d20| 20 20 20 20 65 6c 73 65 | 20 72 65 74 75 72 6e 3b | else| return;|
|00003d30| 0d 20 20 20 20 20 20 62 | 72 65 61 6b 3b 0d 20 20 |. b|reak;. |
|00003d40| 20 20 0d 20 20 20 20 63 | 61 73 65 20 52 4f 55 4e | . c|ase ROUN|
|00003d50| 44 5f 44 49 56 5f 45 58 | 50 52 3a 0d 20 20 20 20 |D_DIV_EX|PR:. |
|00003d60| 63 61 73 65 20 52 4f 55 | 4e 44 5f 4d 4f 44 5f 45 |case ROU|ND_MOD_E|
|00003d70| 58 50 52 3a 09 2f 2a 20 | 72 6f 75 6e 64 20 74 6f |XPR:./* |round to|
|00003d80| 20 63 6c 6f 73 65 73 74 | 20 69 6e 74 65 67 65 72 | closest| integer|
|00003d90| 20 2a 2f 0d 20 20 20 20 | 20 20 7b 0d 09 69 6e 74 | */. | {..int|
|00003da0| 20 6c 61 62 73 5f 72 65 | 6d 20 3d 20 2a 6c 72 65 | labs_re|m = *lre|
|00003db0| 6d 2c 20 68 61 62 73 5f | 72 65 6d 20 3d 20 2a 68 |m, habs_|rem = *h|
|00003dc0| 72 65 6d 3b 0d 09 69 6e | 74 20 6c 61 62 73 5f 64 |rem;..in|t labs_d|
|00003dd0| 65 6e 20 3d 20 6c 64 65 | 6e 2c 20 68 61 62 73 5f |en = lde|n, habs_|
|00003de0| 64 65 6e 20 3d 20 68 64 | 65 6e 2c 20 6c 74 77 69 |den = hd|en, ltwi|
|00003df0| 63 65 2c 20 68 74 77 69 | 63 65 3b 0d 0d 09 2f 2a |ce, htwi|ce;.../*|
|00003e00| 20 67 65 74 20 61 62 73 | 6f 6c 75 74 65 20 76 61 | get abs|olute va|
|00003e10| 6c 75 65 73 20 2a 2f 0d | 09 69 66 20 28 2a 68 72 |lues */.|.if (*hr|
|00003e20| 65 6d 20 3c 20 30 29 20 | 6e 65 67 5f 64 6f 75 62 |em < 0) |neg_doub|
|00003e30| 6c 65 20 28 2a 6c 72 65 | 6d 2c 20 2a 68 72 65 6d |le (*lre|m, *hrem|
|00003e40| 2c 20 26 6c 61 62 73 5f | 72 65 6d 2c 20 26 68 61 |, &labs_|rem, &ha|
|00003e50| 62 73 5f 72 65 6d 29 3b | 0d 09 69 66 20 28 68 64 |bs_rem);|..if (hd|
|00003e60| 65 6e 20 3c 20 30 29 20 | 6e 65 67 5f 64 6f 75 62 |en < 0) |neg_doub|
|00003e70| 6c 65 20 28 6c 64 65 6e | 2c 20 68 64 65 6e 2c 20 |le (lden|, hden, |
|00003e80| 26 6c 61 62 73 5f 64 65 | 6e 2c 20 26 68 61 62 73 |&labs_de|n, &habs|
|00003e90| 5f 64 65 6e 29 3b 0d 0d | 09 2f 2a 20 69 66 20 28 |_den);..|./* if (|
|00003ea0| 32 20 2a 20 61 62 73 20 | 28 6c 72 65 6d 29 20 3e |2 * abs |(lrem) >|
|00003eb0| 3d 20 61 62 73 20 28 6c | 64 65 6e 29 29 20 2a 2f |= abs (l|den)) */|
|00003ec0| 0d 09 6d 75 6c 5f 64 6f | 75 62 6c 65 20 28 32 2c |..mul_do|uble (2,|
|00003ed0| 20 30 2c 20 6c 61 62 73 | 5f 72 65 6d 2c 20 68 61 | 0, labs|_rem, ha|
|00003ee0| 62 73 5f 72 65 6d 2c 20 | 26 6c 74 77 69 63 65 2c |bs_rem, |<wice,|
|00003ef0| 20 26 68 74 77 69 63 65 | 29 3b 0d 09 69 66 20 28 | &htwice|);..if (|
|00003f00| 28 28 75 6e 73 69 67 6e | 65 64 29 20 68 61 62 73 |((unsign|ed) habs|
|00003f10| 5f 64 65 6e 20 3c 20 28 | 75 6e 73 69 67 6e 65 64 |_den < (|unsigned|
|00003f20| 29 20 68 74 77 69 63 65 | 29 0d 09 20 20 20 20 7c |) htwice|).. ||
|00003f30| 7c 20 28 28 28 75 6e 73 | 69 67 6e 65 64 29 20 68 || (((uns|igned) h|
|00003f40| 61 62 73 5f 64 65 6e 20 | 3d 3d 20 28 75 6e 73 69 |abs_den |== (unsi|
|00003f50| 67 6e 65 64 29 20 68 74 | 77 69 63 65 29 0d 09 09 |gned) ht|wice)...|
|00003f60| 26 26 20 28 28 75 6e 73 | 69 67 6e 65 64 29 20 6c |&& ((uns|igned) l|
|00003f70| 61 62 73 5f 64 65 6e 20 | 3c 20 28 75 6e 73 69 67 |abs_den |< (unsig|
|00003f80| 6e 65 64 29 20 6c 74 77 | 69 63 65 29 29 29 0d 09 |ned) ltw|ice)))..|
|00003f90| 20 20 7b 0d 09 20 20 20 | 20 69 66 20 28 2a 68 71 | {.. | if (*hq|
|00003fa0| 75 6f 20 3c 20 30 29 0d | 09 20 20 20 20 20 20 2f |uo < 0).|. /|
|00003fb0| 2a 20 71 75 6f 20 3d 20 | 71 75 6f 20 2d 20 31 3b |* quo = |quo - 1;|
|00003fc0| 20 20 2a 2f 0d 09 20 20 | 20 20 20 20 61 64 64 5f | */.. | add_|
|00003fd0| 64 6f 75 62 6c 65 20 28 | 2a 6c 71 75 6f 2c 20 2a |double (|*lquo, *|
|00003fe0| 68 71 75 6f 2c 20 2d 31 | 2c 20 2d 31 2c 20 6c 71 |hquo, -1|, -1, lq|
|00003ff0| 75 6f 2c 20 68 71 75 6f | 29 3b 0d 09 20 20 20 20 |uo, hquo|);.. |
|00004000| 65 6c 73 65 0d 09 20 20 | 20 20 20 20 2f 2a 20 71 |else.. | /* q|
|00004010| 75 6f 20 3d 20 71 75 6f | 20 2b 20 31 3b 20 2a 2f |uo = quo| + 1; */|
|00004020| 0d 09 20 20 20 20 20 20 | 61 64 64 5f 64 6f 75 62 |.. |add_doub|
|00004030| 6c 65 20 28 2a 6c 71 75 | 6f 2c 20 2a 68 71 75 6f |le (*lqu|o, *hquo|
|00004040| 2c 20 31 2c 20 30 2c 20 | 6c 71 75 6f 2c 20 68 71 |, 1, 0, |lquo, hq|
|00004050| 75 6f 29 3b 0d 09 20 20 | 7d 0d 09 65 6c 73 65 20 |uo);.. |}..else |
|00004060| 72 65 74 75 72 6e 3b 0d | 20 20 20 20 20 20 7d 0d |return;.| }.|
|00004070| 20 20 20 20 20 20 62 72 | 65 61 6b 3b 0d 0d 20 20 | br|eak;.. |
|00004080| 20 20 64 65 66 61 75 6c | 74 3a 0d 20 20 20 20 20 | defaul|t:. |
|00004090| 20 61 62 6f 72 74 20 28 | 29 3b 0d 20 20 20 20 7d | abort (|);. }|
|000040a0| 0d 0d 20 20 2f 2a 20 63 | 6f 6d 70 75 74 65 20 74 |.. /* c|ompute t|
|000040b0| 72 75 65 20 72 65 6d 61 | 69 6e 64 65 72 3a 20 20 |rue rema|inder: |
|000040c0| 72 65 6d 20 3d 20 6e 75 | 6d 20 2d 20 28 71 75 6f |rem = nu|m - (quo|
|000040d0| 20 2a 20 64 65 6e 29 20 | 20 2a 2f 0d 20 20 6d 75 | * den) | */. mu|
|000040e0| 6c 5f 64 6f 75 62 6c 65 | 20 28 2a 6c 71 75 6f 2c |l_double| (*lquo,|
|000040f0| 20 2a 68 71 75 6f 2c 20 | 6c 64 65 6e 5f 6f 72 69 | *hquo, |lden_ori|
|00004100| 67 2c 20 68 64 65 6e 5f | 6f 72 69 67 2c 20 6c 72 |g, hden_|orig, lr|
|00004110| 65 6d 2c 20 68 72 65 6d | 29 3b 0d 20 20 6e 65 67 |em, hrem|);. neg|
|00004120| 5f 64 6f 75 62 6c 65 20 | 28 2a 6c 72 65 6d 2c 20 |_double |(*lrem, |
|00004130| 2a 68 72 65 6d 2c 20 6c | 72 65 6d 2c 20 68 72 65 |*hrem, l|rem, hre|
|00004140| 6d 29 3b 0d 20 20 61 64 | 64 5f 64 6f 75 62 6c 65 |m);. ad|d_double|
|00004150| 20 28 6c 6e 75 6d 5f 6f | 72 69 67 2c 20 68 6e 75 | (lnum_o|rig, hnu|
|00004160| 6d 5f 6f 72 69 67 2c 20 | 2a 6c 72 65 6d 2c 20 2a |m_orig, |*lrem, *|
|00004170| 68 72 65 6d 2c 20 6c 72 | 65 6d 2c 20 68 72 65 6d |hrem, lr|em, hrem|
|00004180| 29 3b 0d 7d 0d 0c 0d 2f | 2a 20 53 70 6c 69 74 20 |);.}.../|* Split |
|00004190| 61 20 74 72 65 65 20 49 | 4e 20 69 6e 74 6f 20 61 |a tree I|N into a|
|000041a0| 20 63 6f 6e 73 74 61 6e | 74 20 61 6e 64 20 61 20 | constan|t and a |
|000041b0| 76 61 72 69 61 62 6c 65 | 20 70 61 72 74 0d 20 20 |variable| part. |
|000041c0| 20 74 68 61 74 20 63 6f | 75 6c 64 20 62 65 20 63 | that co|uld be c|
|000041d0| 6f 6d 62 69 6e 65 64 20 | 77 69 74 68 20 43 4f 44 |ombined |with COD|
|000041e0| 45 20 74 6f 20 6d 61 6b | 65 20 49 4e 2e 0d 20 20 |E to mak|e IN.. |
|000041f0| 20 43 4f 44 45 20 6d 75 | 73 74 20 62 65 20 61 20 | CODE mu|st be a |
|00004200| 63 6f 6d 6d 75 74 61 74 | 69 76 65 20 61 72 69 74 |commutat|ive arit|
|00004210| 68 6d 65 74 69 63 20 6f | 70 65 72 61 74 69 6f 6e |hmetic o|peration|
|00004220| 2e 0d 20 20 20 53 74 6f | 72 65 20 74 68 65 20 63 |.. Sto|re the c|
|00004230| 6f 6e 73 74 61 6e 74 20 | 70 61 72 74 20 69 6e 74 |onstant |part int|
|00004240| 6f 20 2a 43 4f 4e 50 20 | 61 6e 64 20 74 68 65 20 |o *CONP |and the |
|00004250| 76 61 72 69 61 62 6c 65 | 20 69 6e 20 26 56 41 52 |variable| in &VAR|
|00004260| 50 2e 0d 20 20 20 52 65 | 74 75 72 6e 20 31 20 69 |P.. Re|turn 1 i|
|00004270| 66 20 74 68 69 73 20 77 | 61 73 20 64 6f 6e 65 3b |f this w|as done;|
|00004280| 20 7a 65 72 6f 20 6d 65 | 61 6e 73 20 74 68 65 20 | zero me|ans the |
|00004290| 74 72 65 65 20 49 4e 20 | 64 69 64 20 6e 6f 74 20 |tree IN |did not |
|000042a0| 64 65 63 6f 6d 70 6f 73 | 65 0d 20 20 20 74 68 69 |decompos|e. thi|
|000042b0| 73 20 77 61 79 2e 0d 0d | 20 20 20 49 66 20 43 4f |s way...| If CO|
|000042c0| 44 45 20 69 73 20 50 4c | 55 53 5f 45 58 50 52 20 |DE is PL|US_EXPR |
|000042d0| 77 65 20 61 6c 73 6f 20 | 73 70 6c 69 74 20 74 72 |we also |split tr|
|000042e0| 65 65 73 20 74 68 61 74 | 20 75 73 65 20 4d 49 4e |ees that| use MIN|
|000042f0| 55 53 5f 45 58 50 52 2e | 0d 20 20 20 54 68 65 72 |US_EXPR.|. Ther|
|00004300| 65 66 6f 72 65 2c 20 77 | 65 20 6d 75 73 74 20 74 |efore, w|e must t|
|00004310| 65 6c 6c 20 74 68 65 20 | 63 61 6c 6c 65 72 20 77 |ell the |caller w|
|00004320| 68 65 74 68 65 72 20 74 | 68 65 20 76 61 72 69 61 |hether t|he varia|
|00004330| 62 6c 65 20 70 61 72 74 | 0d 20 20 20 77 61 73 20 |ble part|. was |
|00004340| 73 75 62 74 72 61 63 74 | 65 64 2e 20 20 57 65 20 |subtract|ed. We |
|00004350| 64 6f 20 74 68 69 73 20 | 62 79 20 73 74 6f 72 69 |do this |by stori|
|00004360| 6e 67 20 31 20 6f 72 20 | 2d 31 20 69 6e 74 6f 20 |ng 1 or |-1 into |
|00004370| 2a 56 41 52 53 49 47 4e | 50 2e 0d 20 20 20 54 68 |*VARSIGN|P.. Th|
|00004380| 65 20 76 61 6c 75 65 20 | 73 74 6f 72 65 64 20 69 |e value |stored i|
|00004390| 73 20 74 68 65 20 63 6f | 65 66 66 69 63 69 65 6e |s the co|efficien|
|000043a0| 74 20 66 6f 72 20 74 68 | 65 20 76 61 72 69 61 62 |t for th|e variab|
|000043b0| 6c 65 20 74 65 72 6d 2e | 0d 20 20 20 54 68 65 20 |le term.|. The |
|000043c0| 63 6f 6e 73 74 61 6e 74 | 20 74 65 72 6d 20 77 65 |constant| term we|
|000043d0| 20 72 65 74 75 72 6e 20 | 73 68 6f 75 6c 64 20 61 | return |should a|
|000043e0| 6c 77 61 79 73 20 62 65 | 20 61 64 64 65 64 3b 0d |lways be| added;.|
|000043f0| 20 20 20 77 65 20 6e 65 | 67 61 74 65 20 69 74 20 | we ne|gate it |
|00004400| 69 66 20 6e 65 63 65 73 | 73 61 72 79 2e 20 20 2a |if neces|sary. *|
|00004410| 2f 0d 0d 73 74 61 74 69 | 63 20 69 6e 74 0d 73 70 |/..stati|c int.sp|
|00004420| 6c 69 74 5f 74 72 65 65 | 20 28 69 6e 2c 20 63 6f |lit_tree| (in, co|
|00004430| 64 65 2c 20 76 61 72 70 | 2c 20 63 6f 6e 70 2c 20 |de, varp|, conp, |
|00004440| 76 61 72 73 69 67 6e 70 | 29 0d 20 20 20 20 20 74 |varsignp|). t|
|00004450| 72 65 65 20 69 6e 3b 0d | 20 20 20 20 20 65 6e 75 |ree in;.| enu|
|00004460| 6d 20 74 72 65 65 5f 63 | 6f 64 65 20 63 6f 64 65 |m tree_c|ode code|
|00004470| 3b 0d 20 20 20 20 20 74 | 72 65 65 20 2a 76 61 72 |;. t|ree *var|
|00004480| 70 2c 20 2a 63 6f 6e 70 | 3b 0d 20 20 20 20 20 69 |p, *conp|;. i|
|00004490| 6e 74 20 2a 76 61 72 73 | 69 67 6e 70 3b 0d 7b 0d |nt *vars|ignp;.{.|
|000044a0| 20 20 72 65 67 69 73 74 | 65 72 20 74 72 65 65 20 | regist|er tree |
|000044b0| 6f 75 74 74 79 70 65 20 | 3d 20 54 52 45 45 5f 54 |outtype |= TREE_T|
|000044c0| 59 50 45 20 28 69 6e 29 | 3b 0d 20 20 2a 76 61 72 |YPE (in)|;. *var|
|000044d0| 70 20 3d 20 30 3b 0d 20 | 20 2a 63 6f 6e 70 20 3d |p = 0;. | *conp =|
|000044e0| 20 30 3b 0d 0d 20 20 2f | 2a 20 53 74 72 69 70 20 | 0;.. /|* Strip |
|000044f0| 61 6e 79 20 63 6f 6e 76 | 65 72 73 69 6f 6e 73 20 |any conv|ersions |
|00004500| 74 68 61 74 20 64 6f 6e | 27 74 20 63 68 61 6e 67 |that don|'t chang|
|00004510| 65 20 74 68 65 20 6d 61 | 63 68 69 6e 65 20 6d 6f |e the ma|chine mo|
|00004520| 64 65 2e 20 20 2a 2f 0d | 20 20 77 68 69 6c 65 20 |de. */.| while |
|00004530| 28 28 54 52 45 45 5f 43 | 4f 44 45 20 28 69 6e 29 |((TREE_C|ODE (in)|
|00004540| 20 3d 3d 20 4e 4f 50 5f | 45 58 50 52 0d 09 20 20 | == NOP_|EXPR.. |
|00004550| 7c 7c 20 54 52 45 45 5f | 43 4f 44 45 20 28 69 6e ||| TREE_|CODE (in|
|00004560| 29 20 3d 3d 20 43 4f 4e | 56 45 52 54 5f 45 58 50 |) == CON|VERT_EXP|
|00004570| 52 29 0d 09 20 26 26 20 | 28 54 59 50 45 5f 4d 4f |R).. && |(TYPE_MO|
|00004580| 44 45 20 28 54 52 45 45 | 5f 54 59 50 45 20 28 69 |DE (TREE|_TYPE (i|
|00004590| 6e 29 29 0d 09 20 20 20 | 20 20 3d 3d 20 54 59 50 |n)).. | == TYP|
|000045a0| 45 5f 4d 4f 44 45 20 28 | 54 52 45 45 5f 54 59 50 |E_MODE (|TREE_TYP|
|000045b0| 45 20 28 54 52 45 45 5f | 4f 50 45 52 41 4e 44 20 |E (TREE_|OPERAND |
|000045c0| 28 69 6e 2c 20 30 29 29 | 29 29 29 0d 20 20 20 20 |(in, 0))|))). |
|000045d0| 69 6e 20 3d 20 54 52 45 | 45 5f 4f 50 45 52 41 4e |in = TRE|E_OPERAN|
|000045e0| 44 20 28 69 6e 2c 20 30 | 29 3b 0d 0d 20 20 69 66 |D (in, 0|);.. if|
|000045f0| 20 28 54 52 45 45 5f 43 | 4f 44 45 20 28 69 6e 29 | (TREE_C|ODE (in)|
|00004600| 20 3d 3d 20 63 6f 64 65 | 0d 20 20 20 20 20 20 7c | == code|. ||
|00004610| 7c 20 28 54 52 45 45 5f | 43 4f 44 45 20 28 54 52 || (TREE_|CODE (TR|
|00004620| 45 45 5f 54 59 50 45 20 | 28 69 6e 29 29 20 21 3d |EE_TYPE |(in)) !=|
|00004630| 20 52 45 41 4c 5f 54 59 | 50 45 0d 09 20 20 2f 2a | REAL_TY|PE.. /*|
|00004640| 20 57 65 20 63 61 6e 20 | 61 73 73 6f 63 69 61 74 | We can |associat|
|00004650| 65 20 61 64 64 69 74 69 | 6f 6e 20 61 6e 64 20 73 |e additi|on and s|
|00004660| 75 62 74 72 61 63 74 69 | 6f 6e 20 74 6f 67 65 74 |ubtracti|on toget|
|00004670| 68 65 72 0d 09 20 20 20 | 20 20 28 65 76 65 6e 20 |her.. | (even |
|00004680| 74 68 6f 75 67 68 20 74 | 68 65 20 43 20 73 74 61 |though t|he C sta|
|00004690| 6e 64 61 72 64 20 64 6f | 65 73 6e 27 74 20 73 61 |ndard do|esn't sa|
|000046a0| 79 20 73 6f 29 0d 09 20 | 20 20 20 20 66 6f 72 20 |y so).. | for |
|000046b0| 69 6e 74 65 67 65 72 73 | 20 62 65 63 61 75 73 65 |integers| because|
|000046c0| 20 74 68 65 20 76 61 6c | 75 65 20 69 73 20 6e 6f | the val|ue is no|
|000046d0| 74 20 61 66 66 65 63 74 | 65 64 2e 0d 09 20 20 20 |t affect|ed... |
|000046e0| 20 20 46 6f 72 20 72 65 | 61 6c 73 2c 20 74 68 65 | For re|als, the|
|000046f0| 20 76 61 6c 75 65 20 6d | 69 67 68 74 20 62 65 20 | value m|ight be |
|00004700| 61 66 66 65 63 74 65 64 | 2c 20 73 6f 20 77 65 20 |affected|, so we |
|00004710| 63 61 6e 27 74 2e 20 20 | 2a 2f 0d 09 20 20 26 26 |can't. |*/.. &&|
|00004720| 0d 09 20 20 28 28 63 6f | 64 65 20 3d 3d 20 50 4c |.. ((co|de == PL|
|00004730| 55 53 5f 45 58 50 52 20 | 26 26 20 54 52 45 45 5f |US_EXPR |&& TREE_|
|00004740| 43 4f 44 45 20 28 69 6e | 29 20 3d 3d 20 4d 49 4e |CODE (in|) == MIN|
|00004750| 55 53 5f 45 58 50 52 29 | 0d 09 20 20 20 7c 7c 20 |US_EXPR)|.. || |
|00004760| 28 63 6f 64 65 20 3d 3d | 20 4d 49 4e 55 53 5f 45 |(code ==| MINUS_E|
|00004770| 58 50 52 20 26 26 20 54 | 52 45 45 5f 43 4f 44 45 |XPR && T|REE_CODE|
|00004780| 20 28 69 6e 29 20 3d 3d | 20 50 4c 55 53 5f 45 58 | (in) ==| PLUS_EX|
|00004790| 50 52 29 29 29 29 0d 20 | 20 20 20 7b 0d 20 20 20 |PR)))). | {. |
|000047a0| 20 20 20 65 6e 75 6d 20 | 74 72 65 65 5f 63 6f 64 | enum |tree_cod|
|000047b0| 65 20 63 6f 64 65 20 3d | 20 54 52 45 45 5f 43 4f |e code =| TREE_CO|
|000047c0| 44 45 20 28 54 52 45 45 | 5f 4f 50 45 52 41 4e 44 |DE (TREE|_OPERAND|
|000047d0| 20 28 69 6e 2c 20 30 29 | 29 3b 0d 20 20 20 20 20 | (in, 0)|);. |
|000047e0| 20 69 66 20 28 63 6f 64 | 65 20 3d 3d 20 49 4e 54 | if (cod|e == INT|
|000047f0| 45 47 45 52 5f 43 53 54 | 29 0d 09 7b 0d 09 20 20 |EGER_CST|)..{.. |
|00004800| 2a 63 6f 6e 70 20 3d 20 | 54 52 45 45 5f 4f 50 45 |*conp = |TREE_OPE|
|00004810| 52 41 4e 44 20 28 69 6e | 2c 20 30 29 3b 0d 09 20 |RAND (in|, 0);.. |
|00004820| 20 2a 76 61 72 70 20 3d | 20 54 52 45 45 5f 4f 50 | *varp =| TREE_OP|
|00004830| 45 52 41 4e 44 20 28 69 | 6e 2c 20 31 29 3b 0d 09 |ERAND (i|n, 1);..|
|00004840| 20 20 69 66 20 28 54 52 | 45 45 5f 54 59 50 45 20 | if (TR|EE_TYPE |
|00004850| 28 2a 76 61 72 70 29 20 | 21 3d 20 6f 75 74 74 79 |(*varp) |!= outty|
|00004860| 70 65 29 0d 09 20 20 20 | 20 2a 76 61 72 70 20 3d |pe).. | *varp =|
|00004870| 20 63 6f 6e 76 65 72 74 | 20 28 6f 75 74 74 79 70 | convert| (outtyp|
|00004880| 65 2c 20 2a 76 61 72 70 | 29 3b 0d 09 20 20 2a 76 |e, *varp|);.. *v|
|00004890| 61 72 73 69 67 6e 70 20 | 3d 20 28 54 52 45 45 5f |arsignp |= (TREE_|
|000048a0| 43 4f 44 45 20 28 69 6e | 29 20 3d 3d 20 4d 49 4e |CODE (in|) == MIN|
|000048b0| 55 53 5f 45 58 50 52 29 | 20 3f 20 2d 31 20 3a 20 |US_EXPR)| ? -1 : |
|000048c0| 31 3b 0d 09 20 20 72 65 | 74 75 72 6e 20 31 3b 0d |1;.. re|turn 1;.|
|000048d0| 09 7d 0d 20 20 20 20 20 | 20 69 66 20 28 54 52 45 |.}. | if (TRE|
|000048e0| 45 5f 4c 49 54 45 52 41 | 4c 20 28 54 52 45 45 5f |E_LITERA|L (TREE_|
|000048f0| 4f 50 45 52 41 4e 44 20 | 28 69 6e 2c 20 31 29 29 |OPERAND |(in, 1))|
|00004900| 29 0d 09 7b 0d 09 20 20 | 2a 63 6f 6e 70 20 3d 20 |)..{.. |*conp = |
|00004910| 54 52 45 45 5f 4f 50 45 | 52 41 4e 44 20 28 69 6e |TREE_OPE|RAND (in|
|00004920| 2c 20 31 29 3b 0d 09 20 | 20 2a 76 61 72 70 20 3d |, 1);.. | *varp =|
|00004930| 20 54 52 45 45 5f 4f 50 | 45 52 41 4e 44 20 28 69 | TREE_OP|ERAND (i|
|00004940| 6e 2c 20 30 29 3b 0d 09 | 20 20 2a 76 61 72 73 69 |n, 0);..| *varsi|
|00004950| 67 6e 70 20 3d 20 31 3b | 0d 09 20 20 69 66 20 28 |gnp = 1;|.. if (|
|00004960| 54 52 45 45 5f 54 59 50 | 45 20 28 2a 76 61 72 70 |TREE_TYP|E (*varp|
|00004970| 29 20 21 3d 20 6f 75 74 | 74 79 70 65 29 0d 09 20 |) != out|type).. |
|00004980| 20 20 20 2a 76 61 72 70 | 20 3d 20 63 6f 6e 76 65 | *varp| = conve|
|00004990| 72 74 20 28 6f 75 74 74 | 79 70 65 2c 20 2a 76 61 |rt (outt|ype, *va|
|000049a0| 72 70 29 3b 0d 09 20 20 | 69 66 20 28 54 52 45 45 |rp);.. |if (TREE|
|000049b0| 5f 43 4f 44 45 20 28 69 | 6e 29 20 3d 3d 20 4d 49 |_CODE (i|n) == MI|
|000049c0| 4e 55 53 5f 45 58 50 52 | 29 0d 09 20 20 20 20 7b |NUS_EXPR|).. {|
|000049d0| 0d 09 20 20 20 20 20 20 | 2f 2a 20 49 66 20 6f 70 |.. |/* If op|
|000049e0| 65 72 61 74 69 6f 6e 20 | 69 73 20 73 75 62 74 72 |eration |is subtr|
|000049f0| 61 63 74 69 6f 6e 20 61 | 6e 64 20 63 6f 6e 73 74 |action a|nd const|
|00004a00| 61 6e 74 20 69 73 20 73 | 65 63 6f 6e 64 2c 0d 09 |ant is s|econd,..|
|00004a10| 09 20 6d 75 73 74 20 6e | 65 67 61 74 65 20 69 74 |. must n|egate it|
|00004a20| 20 74 6f 20 67 65 74 20 | 61 6e 20 61 64 64 69 74 | to get |an addit|
|00004a30| 69 76 65 20 63 6f 6e 73 | 74 61 6e 74 2e 0d 09 09 |ive cons|tant....|
|00004a40| 20 41 6e 64 20 74 68 69 | 73 20 63 61 6e 6e 6f 74 | And thi|s cannot|
|00004a50| 20 62 65 20 64 6f 6e 65 | 20 75 6e 6c 65 73 73 20 | be done| unless |
|00004a60| 69 74 20 69 73 20 61 20 | 6d 61 6e 69 66 65 73 74 |it is a |manifest|
|00004a70| 20 63 6f 6e 73 74 61 6e | 74 2e 0d 09 09 20 49 74 | constan|t.... It|
|00004a80| 20 63 6f 75 6c 64 20 61 | 6c 73 6f 20 62 65 20 74 | could a|lso be t|
|00004a90| 68 65 20 61 64 64 72 65 | 73 73 20 6f 66 20 61 20 |he addre|ss of a |
|00004aa0| 73 74 61 74 69 63 20 76 | 61 72 69 61 62 6c 65 2e |static v|ariable.|
|00004ab0| 0d 09 09 20 57 65 20 63 | 61 6e 6e 6f 74 20 6e 65 |... We c|annot ne|
|00004ac0| 67 61 74 65 20 74 68 61 | 74 2c 20 73 6f 20 67 69 |gate tha|t, so gi|
|00004ad0| 76 65 20 75 70 2e 20 20 | 2a 2f 0d 09 20 20 20 20 |ve up. |*/.. |
|00004ae0| 20 20 69 66 20 28 54 52 | 45 45 5f 43 4f 44 45 20 | if (TR|EE_CODE |
|00004af0| 28 2a 63 6f 6e 70 29 20 | 3d 3d 20 49 4e 54 45 47 |(*conp) |== INTEG|
|00004b00| 45 52 5f 43 53 54 29 0d | 09 09 2a 63 6f 6e 70 20 |ER_CST).|..*conp |
|00004b10| 3d 20 63 6f 6d 62 69 6e | 65 20 28 4d 49 4e 55 53 |= combin|e (MINUS|
|00004b20| 5f 45 58 50 52 2c 20 69 | 6e 74 65 67 65 72 5f 7a |_EXPR, i|nteger_z|
|00004b30| 65 72 6f 5f 6e 6f 64 65 | 2c 20 2a 63 6f 6e 70 29 |ero_node|, *conp)|
|00004b40| 3b 0d 09 20 20 20 20 20 | 20 65 6c 73 65 0d 09 09 |;.. | else...|
|00004b50| 72 65 74 75 72 6e 20 30 | 3b 0d 09 20 20 20 20 7d |return 0|;.. }|
|00004b60| 0d 09 20 20 72 65 74 75 | 72 6e 20 31 3b 0d 09 7d |.. retu|rn 1;..}|
|00004b70| 0d 20 20 20 20 20 20 69 | 66 20 28 54 52 45 45 5f |. i|f (TREE_|
|00004b80| 4c 49 54 45 52 41 4c 20 | 28 54 52 45 45 5f 4f 50 |LITERAL |(TREE_OP|
|00004b90| 45 52 41 4e 44 20 28 69 | 6e 2c 20 30 29 29 29 0d |ERAND (i|n, 0))).|
|00004ba0| 09 7b 0d 09 20 20 2a 63 | 6f 6e 70 20 3d 20 54 52 |.{.. *c|onp = TR|
|00004bb0| 45 45 5f 4f 50 45 52 41 | 4e 44 20 28 69 6e 2c 20 |EE_OPERA|ND (in, |
|00004bc0| 30 29 3b 0d 09 20 20 2a | 76 61 72 70 20 3d 20 54 |0);.. *|varp = T|
|00004bd0| 52 45 45 5f 4f 50 45 52 | 41 4e 44 20 28 69 6e 2c |REE_OPER|AND (in,|
|00004be0| 20 31 29 3b 0d 09 20 20 | 69 66 20 28 54 52 45 45 | 1);.. |if (TREE|
|00004bf0| 5f 54 59 50 45 20 28 2a | 76 61 72 70 29 20 21 3d |_TYPE (*|varp) !=|
|00004c00| 20 6f 75 74 74 79 70 65 | 29 0d 09 20 20 20 20 2a | outtype|).. *|
|00004c10| 76 61 72 70 20 3d 20 63 | 6f 6e 76 65 72 74 20 28 |varp = c|onvert (|
|00004c20| 6f 75 74 74 79 70 65 2c | 20 2a 76 61 72 70 29 3b |outtype,| *varp);|
|00004c30| 0d 09 20 20 2a 76 61 72 | 73 69 67 6e 70 20 3d 20 |.. *var|signp = |
|00004c40| 28 54 52 45 45 5f 43 4f | 44 45 20 28 69 6e 29 20 |(TREE_CO|DE (in) |
|00004c50| 3d 3d 20 4d 49 4e 55 53 | 5f 45 58 50 52 29 20 3f |== MINUS|_EXPR) ?|
|00004c60| 20 2d 31 20 3a 20 31 3b | 0d 09 20 20 72 65 74 75 | -1 : 1;|.. retu|
|00004c70| 72 6e 20 31 3b 0d 09 7d | 0d 20 20 20 20 7d 0d 20 |rn 1;..}|. }. |
|00004c80| 20 72 65 74 75 72 6e 20 | 30 3b 0d 7d 0d 0c 0d 2f | return |0;.}.../|
|00004c90| 2a 20 43 6f 6d 62 69 6e | 65 20 74 77 6f 20 63 6f |* Combin|e two co|
|00004ca0| 6e 73 74 61 6e 74 73 20 | 4e 55 4d 20 61 6e 64 20 |nstants |NUM and |
|00004cb0| 41 52 47 32 20 75 6e 64 | 65 72 20 6f 70 65 72 61 |ARG2 und|er opera|
|00004cc0| 74 69 6f 6e 20 43 4f 44 | 45 0d 20 20 20 74 6f 20 |tion COD|E. to |
|00004cd0| 70 72 6f 64 75 63 65 20 | 61 20 6e 65 77 20 63 6f |produce |a new co|
|00004ce0| 6e 73 74 61 6e 74 2e 0d | 20 20 20 57 65 20 61 73 |nstant..| We as|
|00004cf0| 73 75 6d 65 20 41 52 47 | 31 20 61 6e 64 20 41 52 |sume ARG|1 and AR|
|00004d00| 47 32 20 68 61 76 65 20 | 74 68 65 20 73 61 6d 65 |G2 have |the same|
|00004d10| 20 64 61 74 61 20 74 79 | 70 65 2c 0d 20 20 20 6f | data ty|pe,. o|
|00004d20| 72 20 61 74 20 6c 65 61 | 73 74 20 61 72 65 20 74 |r at lea|st are t|
|00004d30| 68 65 20 73 61 6d 65 20 | 6b 69 6e 64 20 6f 66 20 |he same |kind of |
|00004d40| 63 6f 6e 73 74 61 6e 74 | 20 61 6e 64 20 74 68 65 |constant| and the|
|00004d50| 20 73 61 6d 65 20 6d 61 | 63 68 69 6e 65 20 6d 6f | same ma|chine mo|
|00004d60| 64 65 2e 20 20 2a 2f 0d | 0d 2f 2a 20 48 61 6e 64 |de. */.|./* Hand|
|00004d70| 6c 65 20 66 6c 6f 61 74 | 69 6e 67 20 6f 76 65 72 |le float|ing over|
|00004d80| 66 6c 6f 77 20 66 6f 72 | 20 60 63 6f 6d 62 69 6e |flow for| `combin|
|00004d90| 65 27 2e 20 20 2a 2f 0d | 73 74 61 74 69 63 20 6a |e'. */.|static j|
|00004da0| 6d 70 5f 62 75 66 20 63 | 6f 6d 62 69 6e 65 5f 65 |mp_buf c|ombine_e|
|00004db0| 72 72 6f 72 3b 0d 0d 74 | 72 65 65 0d 63 6f 6d 62 |rror;..t|ree.comb|
|00004dc0| 69 6e 65 20 28 63 6f 64 | 65 2c 20 61 72 67 31 2c |ine (cod|e, arg1,|
|00004dd0| 20 61 72 67 32 29 0d 20 | 20 20 20 20 65 6e 75 6d | arg2). | enum|
|00004de0| 20 74 72 65 65 5f 63 6f | 64 65 20 63 6f 64 65 3b | tree_co|de code;|
|00004df0| 0d 20 20 20 20 20 72 65 | 67 69 73 74 65 72 20 74 |. re|gister t|
|00004e00| 72 65 65 20 61 72 67 31 | 2c 20 61 72 67 32 3b 0d |ree arg1|, arg2;.|
|00004e10| 7b 0d 20 20 69 66 20 28 | 54 52 45 45 5f 43 4f 44 |{. if (|TREE_COD|
|00004e20| 45 20 28 61 72 67 31 29 | 20 3d 3d 20 49 4e 54 45 |E (arg1)| == INTE|
|00004e30| 47 45 52 5f 43 53 54 29 | 0d 20 20 20 20 7b 0d 20 |GER_CST)|. {. |
|00004e40| 20 20 20 20 20 72 65 67 | 69 73 74 65 72 20 69 6e | reg|ister in|
|00004e50| 74 20 69 6e 74 31 6c 20 | 3d 20 54 52 45 45 5f 49 |t int1l |= TREE_I|
|00004e60| 4e 54 5f 43 53 54 5f 4c | 4f 57 20 28 61 72 67 31 |NT_CST_L|OW (arg1|
|00004e70| 29 3b 0d 20 20 20 20 20 | 20 72 65 67 69 73 74 65 |);. | registe|
|00004e80| 72 20 69 6e 74 20 69 6e | 74 31 68 20 3d 20 54 52 |r int in|t1h = TR|
|00004e90| 45 45 5f 49 4e 54 5f 43 | 53 54 5f 48 49 47 48 20 |EE_INT_C|ST_HIGH |
|00004ea0| 28 61 72 67 31 29 3b 0d | 20 20 20 20 20 20 69 6e |(arg1);.| in|
|00004eb0| 74 20 69 6e 74 32 6c 20 | 3d 20 54 52 45 45 5f 49 |t int2l |= TREE_I|
|00004ec0| 4e 54 5f 43 53 54 5f 4c | 4f 57 20 28 61 72 67 32 |NT_CST_L|OW (arg2|
|00004ed0| 29 3b 0d 20 20 20 20 20 | 20 69 6e 74 20 69 6e 74 |);. | int int|
|00004ee0| 32 68 20 3d 20 54 52 45 | 45 5f 49 4e 54 5f 43 53 |2h = TRE|E_INT_CS|
|00004ef0| 54 5f 48 49 47 48 20 28 | 61 72 67 32 29 3b 0d 20 |T_HIGH (|arg2);. |
|00004f00| 20 20 20 20 20 69 6e 74 | 20 6c 6f 77 2c 20 68 69 | int| low, hi|
|00004f10| 3b 0d 20 20 20 20 20 20 | 69 6e 74 20 67 61 72 62 |;. |int garb|
|00004f20| 61 67 65 6c 2c 20 67 61 | 72 62 61 67 65 68 3b 0d |agel, ga|rbageh;.|
|00004f30| 20 20 20 20 20 20 72 65 | 67 69 73 74 65 72 20 74 | re|gister t|
|00004f40| 72 65 65 20 74 3b 0d 20 | 20 20 20 20 20 69 6e 74 |ree t;. | int|
|00004f50| 20 75 6e 73 20 3d 20 54 | 52 45 45 5f 55 4e 53 49 | uns = T|REE_UNSI|
|00004f60| 47 4e 45 44 20 28 54 52 | 45 45 5f 54 59 50 45 20 |GNED (TR|EE_TYPE |
|00004f70| 28 61 72 67 31 29 29 3b | 0d 0d 20 20 20 20 20 20 |(arg1));|.. |
|00004f80| 73 77 69 74 63 68 20 28 | 63 6f 64 65 29 0d 09 7b |switch (|code)..{|
|00004f90| 0d 09 63 61 73 65 20 42 | 49 54 5f 49 4f 52 5f 45 |..case B|IT_IOR_E|
|00004fa0| 58 50 52 3a 0d 09 20 20 | 74 20 3d 20 62 75 69 6c |XPR:.. |t = buil|
|00004fb0| 64 5f 69 6e 74 5f 32 20 | 28 69 6e 74 31 6c 20 7c |d_int_2 |(int1l ||
|00004fc0| 20 69 6e 74 32 6c 2c 20 | 69 6e 74 31 68 20 7c 20 | int2l, |int1h | |
|00004fd0| 69 6e 74 32 68 29 3b 0d | 09 20 20 62 72 65 61 6b |int2h);.|. break|
|00004fe0| 3b 0d 0d 09 63 61 73 65 | 20 42 49 54 5f 58 4f 52 |;...case| BIT_XOR|
|00004ff0| 5f 45 58 50 52 3a 0d 09 | 20 20 74 20 3d 20 62 75 |_EXPR:..| t = bu|
|00005000| 69 6c 64 5f 69 6e 74 5f | 32 20 28 69 6e 74 31 6c |ild_int_|2 (int1l|
|00005010| 20 5e 20 69 6e 74 32 6c | 2c 20 69 6e 74 31 68 20 | ^ int2l|, int1h |
|00005020| 5e 20 69 6e 74 32 68 29 | 3b 0d 09 20 20 62 72 65 |^ int2h)|;.. bre|
|00005030| 61 6b 3b 0d 0d 09 63 61 | 73 65 20 42 49 54 5f 41 |ak;...ca|se BIT_A|
|00005040| 4e 44 5f 45 58 50 52 3a | 0d 09 20 20 74 20 3d 20 |ND_EXPR:|.. t = |
|00005050| 62 75 69 6c 64 5f 69 6e | 74 5f 32 20 28 69 6e 74 |build_in|t_2 (int|
|00005060| 31 6c 20 26 20 69 6e 74 | 32 6c 2c 20 69 6e 74 31 |1l & int|2l, int1|
|00005070| 68 20 26 20 69 6e 74 32 | 68 29 3b 0d 09 20 20 62 |h & int2|h);.. b|
|00005080| 72 65 61 6b 3b 0d 0d 09 | 63 61 73 65 20 42 49 54 |reak;...|case BIT|
|00005090| 5f 41 4e 44 54 43 5f 45 | 58 50 52 3a 0d 09 20 20 |_ANDTC_E|XPR:.. |
|000050a0| 74 20 3d 20 62 75 69 6c | 64 5f 69 6e 74 5f 32 20 |t = buil|d_int_2 |
|000050b0| 28 69 6e 74 31 6c 20 26 | 20 7e 69 6e 74 32 6c 2c |(int1l &| ~int2l,|
|000050c0| 20 69 6e 74 31 68 20 26 | 20 7e 69 6e 74 32 68 29 | int1h &| ~int2h)|
|000050d0| 3b 0d 09 20 20 62 72 65 | 61 6b 3b 0d 0d 09 63 61 |;.. bre|ak;...ca|
|000050e0| 73 65 20 52 53 48 49 46 | 54 5f 45 58 50 52 3a 0d |se RSHIF|T_EXPR:.|
|000050f0| 09 20 20 69 6e 74 32 6c | 20 3d 20 2d 20 69 6e 74 |. int2l| = - int|
|00005100| 32 6c 3b 0d 09 63 61 73 | 65 20 4c 53 48 49 46 54 |2l;..cas|e LSHIFT|
|00005110| 5f 45 58 50 52 3a 0d 09 | 20 20 6c 73 68 69 66 74 |_EXPR:..| lshift|
|00005120| 5f 64 6f 75 62 6c 65 20 | 28 69 6e 74 31 6c 2c 20 |_double |(int1l, |
|00005130| 69 6e 74 31 68 2c 20 69 | 6e 74 32 6c 2c 0d 09 09 |int1h, i|nt2l,...|
|00005140| 09 20 54 59 50 45 5f 50 | 52 45 43 49 53 49 4f 4e |. TYPE_P|RECISION|
|00005150| 20 28 54 52 45 45 5f 54 | 59 50 45 20 28 61 72 67 | (TREE_T|YPE (arg|
|00005160| 31 29 29 2c 0d 09 09 09 | 20 26 6c 6f 77 2c 20 26 |1)),....| &low, &|
|00005170| 68 69 2c 0d 09 09 09 20 | 21 75 6e 73 29 3b 0d 09 |hi,.... |!uns);..|
|00005180| 20 20 74 20 3d 20 62 75 | 69 6c 64 5f 69 6e 74 5f | t = bu|ild_int_|
|00005190| 32 20 28 6c 6f 77 2c 20 | 68 69 29 3b 0d 09 20 20 |2 (low, |hi);.. |
|000051a0| 62 72 65 61 6b 3b 0d 0d | 09 63 61 73 65 20 52 52 |break;..|.case RR|
|000051b0| 4f 54 41 54 45 5f 45 58 | 50 52 3a 0d 09 20 20 69 |OTATE_EX|PR:.. i|
|000051c0| 6e 74 32 6c 20 3d 20 2d | 20 69 6e 74 32 6c 3b 0d |nt2l = -| int2l;.|
|000051d0| 09 63 61 73 65 20 4c 52 | 4f 54 41 54 45 5f 45 58 |.case LR|OTATE_EX|
|000051e0| 50 52 3a 0d 09 20 20 6c | 72 6f 74 61 74 65 5f 64 |PR:.. l|rotate_d|
|000051f0| 6f 75 62 6c 65 20 28 69 | 6e 74 31 6c 2c 20 69 6e |ouble (i|nt1l, in|
|00005200| 74 31 68 2c 20 69 6e 74 | 32 6c 2c 0d 09 09 09 20 |t1h, int|2l,.... |
|00005210| 20 54 59 50 45 5f 50 52 | 45 43 49 53 49 4f 4e 20 | TYPE_PR|ECISION |
|00005220| 28 54 52 45 45 5f 54 59 | 50 45 20 28 61 72 67 31 |(TREE_TY|PE (arg1|
|00005230| 29 29 2c 0d 09 09 09 20 | 20 26 6c 6f 77 2c 20 26 |)),.... | &low, &|
|00005240| 68 69 29 3b 0d 09 20 20 | 74 20 3d 20 62 75 69 6c |hi);.. |t = buil|
|00005250| 64 5f 69 6e 74 5f 32 20 | 28 6c 6f 77 2c 20 68 69 |d_int_2 |(low, hi|
|00005260| 29 3b 0d 09 20 20 62 72 | 65 61 6b 3b 0d 0d 09 63 |);.. br|eak;...c|
|00005270| 61 73 65 20 50 4c 55 53 | 5f 45 58 50 52 3a 0d 09 |ase PLUS|_EXPR:..|
|00005280| 20 20 69 66 20 28 69 6e | 74 31 68 20 3d 3d 20 30 | if (in|t1h == 0|
|00005290| 29 0d 09 20 20 20 20 7b | 0d 09 20 20 20 20 20 20 |).. {|.. |
|000052a0| 69 6e 74 32 6c 20 2b 3d | 20 69 6e 74 31 6c 3b 0d |int2l +=| int1l;.|
|000052b0| 09 20 20 20 20 20 20 69 | 66 20 28 28 75 6e 73 69 |. i|f ((unsi|
|000052c0| 67 6e 65 64 29 20 69 6e | 74 32 6c 20 3c 20 69 6e |gned) in|t2l < in|
|000052d0| 74 31 6c 29 0d 09 09 69 | 6e 74 32 68 20 2b 3d 20 |t1l)...i|nt2h += |
|000052e0| 31 3b 0d 09 20 20 20 20 | 20 20 74 20 3d 20 62 75 |1;.. | t = bu|
|000052f0| 69 6c 64 5f 69 6e 74 5f | 32 20 28 69 6e 74 32 6c |ild_int_|2 (int2l|
|00005300| 2c 20 69 6e 74 32 68 29 | 3b 0d 09 20 20 20 20 20 |, int2h)|;.. |
|00005310| 20 62 72 65 61 6b 3b 0d | 09 20 20 20 20 7d 0d 09 | break;.|. }..|
|00005320| 20 20 69 66 20 28 69 6e | 74 32 68 20 3d 3d 20 30 | if (in|t2h == 0|
|00005330| 29 0d 09 20 20 20 20 7b | 0d 09 20 20 20 20 20 20 |).. {|.. |
|00005340| 69 6e 74 31 6c 20 2b 3d | 20 69 6e 74 32 6c 3b 0d |int1l +=| int2l;.|
|00005350| 09 20 20 20 20 20 20 69 | 66 20 28 28 75 6e 73 69 |. i|f ((unsi|
|00005360| 67 6e 65 64 29 20 69 6e | 74 31 6c 20 3c 20 69 6e |gned) in|t1l < in|
|00005370| 74 32 6c 29 0d 09 09 69 | 6e 74 31 68 20 2b 3d 20 |t2l)...i|nt1h += |
|00005380| 31 3b 0d 09 20 20 20 20 | 20 20 74 20 3d 20 62 75 |1;.. | t = bu|
|00005390| 69 6c 64 5f 69 6e 74 5f | 32 20 28 69 6e 74 31 6c |ild_int_|2 (int1l|
|000053a0| 2c 20 69 6e 74 31 68 29 | 3b 0d 09 20 20 20 20 20 |, int1h)|;.. |
|000053b0| 20 62 72 65 61 6b 3b 0d | 09 20 20 20 20 7d 0d 09 | break;.|. }..|
|000053c0| 20 20 61 64 64 5f 64 6f | 75 62 6c 65 20 28 69 6e | add_do|uble (in|
|000053d0| 74 31 6c 2c 20 69 6e 74 | 31 68 2c 20 69 6e 74 32 |t1l, int|1h, int2|
|000053e0| 6c 2c 20 69 6e 74 32 68 | 2c 20 26 6c 6f 77 2c 20 |l, int2h|, &low, |
|000053f0| 26 68 69 29 3b 0d 09 20 | 20 74 20 3d 20 62 75 69 |&hi);.. | t = bui|
|00005400| 6c 64 5f 69 6e 74 5f 32 | 20 28 6c 6f 77 2c 20 68 |ld_int_2| (low, h|
|00005410| 69 29 3b 0d 09 20 20 62 | 72 65 61 6b 3b 0d 0d 09 |i);.. b|reak;...|
|00005420| 63 61 73 65 20 4d 49 4e | 55 53 5f 45 58 50 52 3a |case MIN|US_EXPR:|
|00005430| 0d 09 20 20 69 66 20 28 | 69 6e 74 31 68 20 3d 3d |.. if (|int1h ==|
|00005440| 20 30 20 26 26 20 69 6e | 74 31 6c 20 3d 3d 20 30 | 0 && in|t1l == 0|
|00005450| 29 0d 09 20 20 20 20 7b | 0d 09 20 20 20 20 20 20 |).. {|.. |
|00005460| 74 20 3d 20 62 75 69 6c | 64 5f 69 6e 74 5f 32 20 |t = buil|d_int_2 |
|00005470| 28 2d 20 69 6e 74 32 6c | 2c 20 2d 20 69 6e 74 32 |(- int2l|, - int2|
|00005480| 68 20 2d 20 28 69 6e 74 | 32 6c 20 21 3d 20 30 29 |h - (int|2l != 0)|
|00005490| 29 3b 0d 09 20 20 20 20 | 20 20 62 72 65 61 6b 3b |);.. | break;|
|000054a0| 0d 09 20 20 20 20 7d 0d | 09 20 20 69 66 20 28 69 |.. }.|. if (i|
|000054b0| 6e 74 32 68 20 3d 3d 20 | 30 20 26 26 20 69 6e 74 |nt2h == |0 && int|
|000054c0| 32 6c 20 3d 3d 20 30 29 | 0d 09 20 20 20 20 7b 0d |2l == 0)|.. {.|
|000054d0| 09 20 20 20 20 20 20 74 | 20 3d 20 62 75 69 6c 64 |. t| = build|
|000054e0| 5f 69 6e 74 5f 32 20 28 | 69 6e 74 31 6c 2c 20 69 |_int_2 (|int1l, i|
|000054f0| 6e 74 31 68 29 3b 0d 09 | 20 20 20 20 20 20 62 72 |nt1h);..| br|
|00005500| 65 61 6b 3b 0d 09 20 20 | 20 20 7d 0d 09 20 20 6e |eak;.. | }.. n|
|00005510| 65 67 5f 64 6f 75 62 6c | 65 20 28 69 6e 74 32 6c |eg_doubl|e (int2l|
|00005520| 2c 20 69 6e 74 32 68 2c | 20 26 69 6e 74 32 6c 2c |, int2h,| &int2l,|
|00005530| 20 26 69 6e 74 32 68 29 | 3b 0d 09 20 20 61 64 64 | &int2h)|;.. add|
|00005540| 5f 64 6f 75 62 6c 65 20 | 28 69 6e 74 31 6c 2c 20 |_double |(int1l, |
|00005550| 69 6e 74 31 68 2c 20 69 | 6e 74 32 6c 2c 20 69 6e |int1h, i|nt2l, in|
|00005560| 74 32 68 2c 20 26 6c 6f | 77 2c 20 26 68 69 29 3b |t2h, &lo|w, &hi);|
|00005570| 0d 09 20 20 74 20 3d 20 | 62 75 69 6c 64 5f 69 6e |.. t = |build_in|
|00005580| 74 5f 32 20 28 6c 6f 77 | 2c 20 68 69 29 3b 0d 09 |t_2 (low|, hi);..|
|00005590| 20 20 62 72 65 61 6b 3b | 0d 0d 09 63 61 73 65 20 | break;|...case |
|000055a0| 4d 55 4c 54 5f 45 58 50 | 52 3a 0d 20 20 2f 2a 20 |MULT_EXP|R:. /* |
|000055b0| 4f 70 74 69 6d 69 7a 65 | 20 73 69 6d 70 6c 65 20 |Optimize| simple |
|000055c0| 63 61 73 65 73 2e 20 20 | 2a 2f 0d 09 20 20 69 66 |cases. |*/.. if|
|000055d0| 20 28 69 6e 74 31 68 20 | 3d 3d 20 30 29 0d 09 20 | (int1h |== 0).. |
|000055e0| 20 20 20 7b 0d 09 20 20 | 20 20 20 20 75 6e 73 69 | {.. | unsi|
|000055f0| 67 6e 65 64 20 74 65 6d | 70 3b 0d 0d 09 20 20 20 |gned tem|p;... |
|00005600| 20 20 20 73 77 69 74 63 | 68 20 28 69 6e 74 31 6c | switc|h (int1l|
|00005610| 29 0d 09 09 7b 0d 09 09 | 63 61 73 65 20 30 3a 0d |)...{...|case 0:.|
|00005620| 09 09 20 20 74 20 3d 20 | 62 75 69 6c 64 5f 69 6e |.. t = |build_in|
|00005630| 74 5f 32 20 28 30 2c 20 | 30 29 3b 0d 09 09 20 20 |t_2 (0, |0);... |
|00005640| 67 6f 74 6f 20 67 6f 74 | 5f 69 74 3b 0d 09 09 63 |goto got|_it;...c|
|00005650| 61 73 65 20 31 3a 0d 09 | 09 20 20 74 20 3d 20 62 |ase 1:..|. t = b|
|00005660| 75 69 6c 64 5f 69 6e 74 | 5f 32 20 28 69 6e 74 32 |uild_int|_2 (int2|
|00005670| 6c 2c 20 69 6e 74 32 68 | 29 3b 0d 09 09 20 20 67 |l, int2h|);... g|
|00005680| 6f 74 6f 20 67 6f 74 5f | 69 74 3b 0d 09 09 63 61 |oto got_|it;...ca|
|00005690| 73 65 20 32 3a 0d 09 09 | 20 20 74 65 6d 70 20 3d |se 2:...| temp =|
|000056a0| 20 69 6e 74 32 6c 20 2b | 20 69 6e 74 32 6c 3b 0d | int2l +| int2l;.|
|000056b0| 09 09 20 20 69 6e 74 32 | 68 20 3d 20 69 6e 74 32 |.. int2|h = int2|
|000056c0| 68 20 2a 20 32 20 2b 20 | 28 74 65 6d 70 20 3c 20 |h * 2 + |(temp < |
|000056d0| 69 6e 74 32 6c 29 3b 0d | 09 09 20 20 74 20 3d 20 |int2l);.|.. t = |
|000056e0| 62 75 69 6c 64 5f 69 6e | 74 5f 32 20 28 74 65 6d |build_in|t_2 (tem|
|000056f0| 70 2c 20 69 6e 74 32 68 | 29 3b 0d 09 09 20 20 67 |p, int2h|);... g|
|00005700| 6f 74 6f 20 67 6f 74 5f | 69 74 3b 0d 09 09 63 61 |oto got_|it;...ca|
|00005710| 73 65 20 33 3a 0d 09 09 | 20 20 74 65 6d 70 20 3d |se 3:...| temp =|
|00005720| 20 69 6e 74 32 6c 20 2b | 20 69 6e 74 32 6c 20 2b | int2l +| int2l +|
|00005730| 20 69 6e 74 32 6c 3b 0d | 09 09 20 20 69 6e 74 32 | int2l;.|.. int2|
|00005740| 68 20 3d 20 69 6e 74 32 | 68 20 2a 20 33 20 2b 20 |h = int2|h * 3 + |
|00005750| 28 74 65 6d 70 20 3c 20 | 69 6e 74 32 6c 29 3b 0d |(temp < |int2l);.|
|00005760| 09 09 20 20 74 20 3d 20 | 62 75 69 6c 64 5f 69 6e |.. t = |build_in|
|00005770| 74 5f 32 20 28 74 65 6d | 70 2c 20 69 6e 74 32 68 |t_2 (tem|p, int2h|
|00005780| 29 3b 0d 09 09 20 20 67 | 6f 74 6f 20 67 6f 74 5f |);... g|oto got_|
|00005790| 69 74 3b 0d 09 09 63 61 | 73 65 20 34 3a 0d 09 09 |it;...ca|se 4:...|
|000057a0| 20 20 74 65 6d 70 20 3d | 20 69 6e 74 32 6c 20 2b | temp =| int2l +|
|000057b0| 20 69 6e 74 32 6c 3b 0d | 09 09 20 20 69 6e 74 32 | int2l;.|.. int2|
|000057c0| 68 20 3d 20 69 6e 74 32 | 68 20 2a 20 34 20 2b 20 |h = int2|h * 4 + |
|000057d0| 28 74 65 6d 70 20 3c 20 | 69 6e 74 32 6c 29 20 3c |(temp < |int2l) <|
|000057e0| 3c 20 31 3b 0d 09 09 20 | 20 69 6e 74 32 6c 20 3d |< 1;... | int2l =|
|000057f0| 20 74 65 6d 70 3b 0d 09 | 09 20 20 74 65 6d 70 20 | temp;..|. temp |
|00005800| 2b 3d 20 74 65 6d 70 3b | 0d 09 09 20 20 69 6e 74 |+= temp;|... int|
|00005810| 32 68 20 2b 3d 20 28 74 | 65 6d 70 20 3c 20 69 6e |2h += (t|emp < in|
|00005820| 74 32 6c 29 3b 0d 09 09 | 20 20 74 20 3d 20 62 75 |t2l);...| t = bu|
|00005830| 69 6c 64 5f 69 6e 74 5f | 32 20 28 74 65 6d 70 2c |ild_int_|2 (temp,|
|00005840| 20 69 6e 74 32 68 29 3b | 0d 09 09 20 20 67 6f 74 | int2h);|... got|
|00005850| 6f 20 67 6f 74 5f 69 74 | 3b 0d 09 09 63 61 73 65 |o got_it|;...case|
|00005860| 20 38 3a 0d 09 09 20 20 | 74 65 6d 70 20 3d 20 69 | 8:... |temp = i|
|00005870| 6e 74 32 6c 20 2b 20 69 | 6e 74 32 6c 3b 0d 09 09 |nt2l + i|nt2l;...|
|00005880| 20 20 69 6e 74 32 68 20 | 3d 20 69 6e 74 32 68 20 | int2h |= int2h |
|00005890| 2a 20 38 20 2b 20 28 74 | 65 6d 70 20 3c 20 69 6e |* 8 + (t|emp < in|
|000058a0| 74 32 6c 29 20 3c 3c 20 | 32 3b 0d 09 09 20 20 69 |t2l) << |2;... i|
|000058b0| 6e 74 32 6c 20 3d 20 74 | 65 6d 70 3b 0d 09 09 20 |nt2l = t|emp;... |
|000058c0| 20 74 65 6d 70 20 2b 3d | 20 74 65 6d 70 3b 0d 09 | temp +=| temp;..|
|000058d0| 09 20 20 69 6e 74 32 68 | 20 2b 3d 20 28 74 65 6d |. int2h| += (tem|
|000058e0| 70 20 3c 20 69 6e 74 32 | 6c 29 20 3c 3c 20 31 3b |p < int2|l) << 1;|
|000058f0| 0d 09 09 20 20 69 6e 74 | 32 6c 20 3d 20 74 65 6d |... int|2l = tem|
|00005900| 70 3b 0d 09 09 20 20 74 | 65 6d 70 20 2b 3d 20 74 |p;... t|emp += t|
|00005910| 65 6d 70 3b 0d 09 09 20 | 20 69 6e 74 32 68 20 2b |emp;... | int2h +|
|00005920| 3d 20 28 74 65 6d 70 20 | 3c 20 69 6e 74 32 6c 29 |= (temp |< int2l)|
|00005930| 3b 0d 09 09 20 20 74 20 | 3d 20 62 75 69 6c 64 5f |;... t |= build_|
|00005940| 69 6e 74 5f 32 20 28 74 | 65 6d 70 2c 20 69 6e 74 |int_2 (t|emp, int|
|00005950| 32 68 29 3b 0d 09 09 20 | 20 67 6f 74 6f 20 67 6f |2h);... | goto go|
|00005960| 74 5f 69 74 3b 0d 09 09 | 64 65 66 61 75 6c 74 3a |t_it;...|default:|
|00005970| 0d 09 09 20 20 62 72 65 | 61 6b 3b 0d 09 09 7d 0d |... bre|ak;...}.|
|00005980| 09 20 20 20 20 7d 0d 0d | 09 20 20 69 66 20 28 69 |. }..|. if (i|
|00005990| 6e 74 32 68 20 3d 3d 20 | 30 29 0d 09 20 20 20 20 |nt2h == |0).. |
|000059a0| 7b 0d 09 20 20 20 20 20 | 20 69 66 20 28 69 6e 74 |{.. | if (int|
|000059b0| 32 6c 20 3d 3d 20 30 29 | 0d 09 09 7b 0d 09 09 20 |2l == 0)|...{... |
|000059c0| 20 74 20 3d 20 62 75 69 | 6c 64 5f 69 6e 74 5f 32 | t = bui|ld_int_2|
|000059d0| 20 28 30 2c 20 30 29 3b | 0d 09 09 20 20 62 72 65 | (0, 0);|... bre|
|000059e0| 61 6b 3b 0d 09 09 7d 0d | 09 20 20 20 20 20 20 69 |ak;...}.|. i|
|000059f0| 66 20 28 69 6e 74 32 6c | 20 3d 3d 20 31 29 0d 09 |f (int2l| == 1)..|
|00005a00| 09 7b 0d 09 09 20 20 74 | 20 3d 20 62 75 69 6c 64 |.{... t| = build|
|00005a10| 5f 69 6e 74 5f 32 20 28 | 69 6e 74 31 6c 2c 20 69 |_int_2 (|int1l, i|
|00005a20| 6e 74 31 68 29 3b 0d 09 | 09 20 20 62 72 65 61 6b |nt1h);..|. break|
|00005a30| 3b 0d 09 09 7d 0d 09 20 | 20 20 20 7d 0d 0d 09 20 |;...}.. | }... |
|00005a40| 20 6d 75 6c 5f 64 6f 75 | 62 6c 65 20 28 69 6e 74 | mul_dou|ble (int|
|00005a50| 31 6c 2c 20 69 6e 74 31 | 68 2c 20 69 6e 74 32 6c |1l, int1|h, int2l|
|00005a60| 2c 20 69 6e 74 32 68 2c | 20 26 6c 6f 77 2c 20 26 |, int2h,| &low, &|
|00005a70| 68 69 29 3b 0d 09 20 20 | 74 20 3d 20 62 75 69 6c |hi);.. |t = buil|
|00005a80| 64 5f 69 6e 74 5f 32 20 | 28 6c 6f 77 2c 20 68 69 |d_int_2 |(low, hi|
|00005a90| 29 3b 0d 09 20 20 62 72 | 65 61 6b 3b 0d 0d 09 63 |);.. br|eak;...c|
|00005aa0| 61 73 65 20 54 52 55 4e | 43 5f 44 49 56 5f 45 58 |ase TRUN|C_DIV_EX|
|00005ab0| 50 52 3a 20 63 61 73 65 | 20 52 4f 55 4e 44 5f 44 |PR: case| ROUND_D|
|00005ac0| 49 56 5f 45 58 50 52 3a | 20 0d 09 63 61 73 65 20 |IV_EXPR:| ..case |
|00005ad0| 46 4c 4f 4f 52 5f 44 49 | 56 5f 45 58 50 52 3a 20 |FLOOR_DI|V_EXPR: |
|00005ae0| 63 61 73 65 20 43 45 49 | 4c 5f 44 49 56 5f 45 58 |case CEI|L_DIV_EX|
|00005af0| 50 52 3a 0d 09 63 61 73 | 65 20 45 58 41 43 54 5f |PR:..cas|e EXACT_|
|00005b00| 44 49 56 5f 45 58 50 52 | 3a 0d 09 20 20 69 66 20 |DIV_EXPR|:.. if |
|00005b10| 28 69 6e 74 32 68 20 3d | 3d 20 30 20 26 26 20 69 |(int2h =|= 0 && i|
|00005b20| 6e 74 32 6c 20 3d 3d 20 | 31 29 0d 09 20 20 20 20 |nt2l == |1).. |
|00005b30| 7b 0d 09 20 20 20 20 20 | 20 74 20 3d 20 62 75 69 |{.. | t = bui|
|00005b40| 6c 64 5f 69 6e 74 5f 32 | 20 28 69 6e 74 31 6c 2c |ld_int_2| (int1l,|
|00005b50| 20 69 6e 74 31 68 29 3b | 0d 09 20 20 20 20 20 20 | int1h);|.. |
|00005b60| 62 72 65 61 6b 3b 0d 09 | 20 20 20 20 7d 0d 09 20 |break;..| }.. |
|00005b70| 20 69 66 20 28 69 6e 74 | 31 6c 20 3d 3d 20 69 6e | if (int|1l == in|
|00005b80| 74 32 6c 20 26 26 20 69 | 6e 74 31 68 20 3d 3d 20 |t2l && i|nt1h == |
|00005b90| 69 6e 74 32 68 29 0d 09 | 20 20 20 20 7b 0d 09 20 |int2h)..| {.. |
|00005ba0| 20 20 20 20 20 69 66 20 | 28 28 69 6e 74 31 6c 20 | if |((int1l |
|00005bb0| 7c 20 69 6e 74 31 68 29 | 20 3d 3d 20 30 29 0d 09 || int1h)| == 0)..|
|00005bc0| 09 61 62 6f 72 74 20 28 | 29 3b 0d 09 20 20 20 20 |.abort (|);.. |
|00005bd0| 20 20 74 20 3d 20 62 75 | 69 6c 64 5f 69 6e 74 5f | t = bu|ild_int_|
|00005be0| 32 20 28 31 2c 20 30 29 | 3b 0d 09 20 20 20 20 20 |2 (1, 0)|;.. |
|00005bf0| 20 62 72 65 61 6b 3b 0d | 09 20 20 20 20 7d 0d 09 | break;.|. }..|
|00005c00| 20 20 64 69 76 5f 61 6e | 64 5f 72 6f 75 6e 64 5f | div_an|d_round_|
|00005c10| 64 6f 75 62 6c 65 20 28 | 63 6f 64 65 2c 20 75 6e |double (|code, un|
|00005c20| 73 2c 20 69 6e 74 31 6c | 2c 20 69 6e 74 31 68 2c |s, int1l|, int1h,|
|00005c30| 20 69 6e 74 32 6c 2c 20 | 69 6e 74 32 68 2c 0d 09 | int2l, |int2h,..|
|00005c40| 09 09 09 26 6c 6f 77 2c | 20 26 68 69 2c 20 26 67 |...&low,| &hi, &g|
|00005c50| 61 72 62 61 67 65 6c 2c | 20 26 67 61 72 62 61 67 |arbagel,| &garbag|
|00005c60| 65 68 29 3b 0d 09 20 20 | 74 20 3d 20 62 75 69 6c |eh);.. |t = buil|
|00005c70| 64 5f 69 6e 74 5f 32 20 | 28 6c 6f 77 2c 20 68 69 |d_int_2 |(low, hi|
|00005c80| 29 3b 0d 09 20 20 62 72 | 65 61 6b 3b 0d 0d 09 63 |);.. br|eak;...c|
|00005c90| 61 73 65 20 54 52 55 4e | 43 5f 4d 4f 44 5f 45 58 |ase TRUN|C_MOD_EX|
|00005ca0| 50 52 3a 20 63 61 73 65 | 20 52 4f 55 4e 44 5f 4d |PR: case| ROUND_M|
|00005cb0| 4f 44 5f 45 58 50 52 3a | 20 0d 09 63 61 73 65 20 |OD_EXPR:| ..case |
|00005cc0| 46 4c 4f 4f 52 5f 4d 4f | 44 5f 45 58 50 52 3a 20 |FLOOR_MO|D_EXPR: |
|00005cd0| 63 61 73 65 20 43 45 49 | 4c 5f 4d 4f 44 5f 45 58 |case CEI|L_MOD_EX|
|00005ce0| 50 52 3a 0d 09 20 20 64 | 69 76 5f 61 6e 64 5f 72 |PR:.. d|iv_and_r|
|00005cf0| 6f 75 6e 64 5f 64 6f 75 | 62 6c 65 20 28 63 6f 64 |ound_dou|ble (cod|
|00005d00| 65 2c 20 75 6e 73 2c 20 | 69 6e 74 31 6c 2c 20 69 |e, uns, |int1l, i|
|00005d10| 6e 74 31 68 2c 20 69 6e | 74 32 6c 2c 20 69 6e 74 |nt1h, in|t2l, int|
|00005d20| 32 68 2c 0d 09 09 09 09 | 26 67 61 72 62 61 67 65 |2h,.....|&garbage|
|00005d30| 6c 2c 20 26 67 61 72 62 | 61 67 65 68 2c 20 26 6c |l, &garb|ageh, &l|
|00005d40| 6f 77 2c 20 26 68 69 29 | 3b 0d 09 20 20 74 20 3d |ow, &hi)|;.. t =|
|00005d50| 20 62 75 69 6c 64 5f 69 | 6e 74 5f 32 20 28 6c 6f | build_i|nt_2 (lo|
|00005d60| 77 2c 20 68 69 29 3b 0d | 09 20 20 62 72 65 61 6b |w, hi);.|. break|
|00005d70| 3b 0d 0d 09 63 61 73 65 | 20 4d 49 4e 5f 45 58 50 |;...case| MIN_EXP|
|00005d80| 52 3a 0d 09 63 61 73 65 | 20 4d 41 58 5f 45 58 50 |R:..case| MAX_EXP|
|00005d90| 52 3a 0d 09 20 20 69 66 | 20 28 75 6e 73 29 0d 09 |R:.. if| (uns)..|
|00005da0| 20 20 20 20 7b 0d 09 20 | 20 20 20 20 20 6c 6f 77 | {.. | low|
|00005db0| 20 3d 20 28 28 28 75 6e | 73 69 67 6e 65 64 29 20 | = (((un|signed) |
|00005dc0| 69 6e 74 31 68 20 3c 20 | 28 75 6e 73 69 67 6e 65 |int1h < |(unsigne|
|00005dd0| 64 29 20 69 6e 74 32 68 | 29 0d 09 09 20 20 20 20 |d) int2h|)... |
|00005de0| 20 7c 7c 20 28 28 28 75 | 6e 73 69 67 6e 65 64 29 | || (((u|nsigned)|
|00005df0| 20 69 6e 74 31 68 20 3d | 3d 20 28 75 6e 73 69 67 | int1h =|= (unsig|
|00005e00| 6e 65 64 29 20 69 6e 74 | 32 68 29 0d 09 09 09 20 |ned) int|2h).... |
|00005e10| 26 26 20 28 28 75 6e 73 | 69 67 6e 65 64 29 20 69 |&& ((uns|igned) i|
|00005e20| 6e 74 31 6c 20 3c 20 28 | 75 6e 73 69 67 6e 65 64 |nt1l < (|unsigned|
|00005e30| 29 20 69 6e 74 32 6c 29 | 29 29 3b 0d 09 20 20 20 |) int2l)|));.. |
|00005e40| 20 7d 0d 09 20 20 65 6c | 73 65 0d 09 20 20 20 20 | }.. el|se.. |
|00005e50| 7b 0d 09 20 20 20 20 20 | 20 6c 6f 77 20 3d 20 28 |{.. | low = (|
|00005e60| 28 69 6e 74 31 68 20 3c | 20 69 6e 74 32 68 29 0d |(int1h <| int2h).|
|00005e70| 09 09 20 20 20 20 20 7c | 7c 20 28 28 69 6e 74 31 |.. ||| ((int1|
|00005e80| 68 20 3d 3d 20 69 6e 74 | 32 68 29 0d 09 09 09 20 |h == int|2h).... |
|00005e90| 26 26 20 28 28 75 6e 73 | 69 67 6e 65 64 29 20 69 |&& ((uns|igned) i|
|00005ea0| 6e 74 31 6c 20 3c 20 28 | 75 6e 73 69 67 6e 65 64 |nt1l < (|unsigned|
|00005eb0| 29 20 69 6e 74 32 6c 29 | 29 29 3b 0d 09 20 20 20 |) int2l)|));.. |
|00005ec0| 20 7d 0d 09 20 20 69 66 | 20 28 6c 6f 77 20 3d 3d | }.. if| (low ==|
|00005ed0| 20 28 63 6f 64 65 20 3d | 3d 20 4d 49 4e 5f 45 58 | (code =|= MIN_EX|
|00005ee0| 50 52 29 29 0d 09 20 20 | 20 20 74 20 3d 20 62 75 |PR)).. | t = bu|
|00005ef0| 69 6c 64 5f 69 6e 74 5f | 32 20 28 69 6e 74 31 6c |ild_int_|2 (int1l|
|00005f00| 2c 20 69 6e 74 31 68 29 | 3b 0d 09 20 20 65 6c 73 |, int1h)|;.. els|
|00005f10| 65 0d 09 20 20 20 20 74 | 20 3d 20 62 75 69 6c 64 |e.. t| = build|
|00005f20| 5f 69 6e 74 5f 32 20 28 | 69 6e 74 32 6c 2c 20 69 |_int_2 (|int2l, i|
|00005f30| 6e 74 32 68 29 3b 0d 09 | 20 20 62 72 65 61 6b 3b |nt2h);..| break;|
|00005f40| 0d 0d 09 64 65 66 61 75 | 6c 74 3a 0d 09 20 20 61 |...defau|lt:.. a|
|00005f50| 62 6f 72 74 20 28 29 3b | 0d 09 7d 0d 20 20 20 20 |bort ();|..}. |
|00005f60| 67 6f 74 5f 69 74 3a 0d | 20 20 20 20 20 20 54 52 |got_it:.| TR|
|00005f70| 45 45 5f 54 59 50 45 20 | 28 74 29 20 3d 20 54 52 |EE_TYPE |(t) = TR|
|00005f80| 45 45 5f 54 59 50 45 20 | 28 61 72 67 31 29 3b 0d |EE_TYPE |(arg1);.|
|00005f90| 20 20 20 20 20 20 66 6f | 72 63 65 5f 66 69 74 5f | fo|rce_fit_|
|00005fa0| 74 79 70 65 20 28 74 29 | 3b 0d 20 20 20 20 20 20 |type (t)|;. |
|00005fb0| 72 65 74 75 72 6e 20 74 | 3b 0d 20 20 20 20 7d 0d |return t|;. }.|
|00005fc0| 23 69 66 20 21 20 64 65 | 66 69 6e 65 64 20 28 52 |#if ! de|fined (R|
|00005fd0| 45 41 4c 5f 49 53 5f 4e | 4f 54 5f 44 4f 55 42 4c |EAL_IS_N|OT_DOUBL|
|00005fe0| 45 29 20 7c 7c 20 64 65 | 66 69 6e 65 64 20 28 52 |E) || de|fined (R|
|00005ff0| 45 41 4c 5f 41 52 49 54 | 48 4d 45 54 49 43 29 0d |EAL_ARIT|HMETIC).|
|00006000| 20 20 69 66 20 28 54 52 | 45 45 5f 43 4f 44 45 20 | if (TR|EE_CODE |
|00006010| 28 61 72 67 31 29 20 3d | 3d 20 52 45 41 4c 5f 43 |(arg1) =|= REAL_C|
|00006020| 53 54 29 0d 20 20 20 20 | 7b 0d 20 20 20 20 20 20 |ST). |{. |
|00006030| 72 65 67 69 73 74 65 72 | 20 52 45 41 4c 5f 56 41 |register| REAL_VA|
|00006040| 4c 55 45 5f 54 59 50 45 | 20 64 31 20 3d 20 54 52 |LUE_TYPE| d1 = TR|
|00006050| 45 45 5f 52 45 41 4c 5f | 43 53 54 20 28 61 72 67 |EE_REAL_|CST (arg|
|00006060| 31 29 3b 0d 20 20 20 20 | 20 20 72 65 67 69 73 74 |1);. | regist|
|00006070| 65 72 20 52 45 41 4c 5f | 56 41 4c 55 45 5f 54 59 |er REAL_|VALUE_TY|
|00006080| 50 45 20 64 32 20 3d 20 | 54 52 45 45 5f 52 45 41 |PE d2 = |TREE_REA|
|00006090| 4c 5f 43 53 54 20 28 61 | 72 67 32 29 3b 0d 20 20 |L_CST (a|rg2);. |
|000060a0| 20 20 20 20 72 65 67 69 | 73 74 65 72 20 52 45 41 | regi|ster REA|
|000060b0| 4c 5f 56 41 4c 55 45 5f | 54 59 50 45 20 76 61 6c |L_VALUE_|TYPE val|
|000060c0| 75 65 3b 0d 0d 20 20 20 | 20 20 20 69 66 20 28 73 |ue;.. | if (s|
|000060d0| 65 74 6a 6d 70 20 28 63 | 6f 6d 62 69 6e 65 5f 65 |etjmp (c|ombine_e|
|000060e0| 72 72 6f 72 29 29 0d 09 | 7b 0d 09 20 20 77 61 72 |rror))..|{.. war|
|000060f0| 6e 69 6e 67 20 28 22 66 | 6c 6f 61 74 69 6e 67 20 |ning ("f|loating |
|00006100| 6f 76 65 72 66 6c 6f 77 | 20 69 6e 20 63 6f 6e 73 |overflow| in cons|
|00006110| 74 61 6e 74 20 66 6f 6c | 64 69 6e 67 22 29 3b 0d |tant fol|ding");.|
|00006120| 09 20 20 72 65 74 75 72 | 6e 20 62 75 69 6c 64 20 |. retur|n build |
|00006130| 28 63 6f 64 65 2c 20 54 | 52 45 45 5f 54 59 50 45 |(code, T|REE_TYPE|
|00006140| 20 28 61 72 67 31 29 2c | 20 61 72 67 31 2c 20 61 | (arg1),| arg1, a|
|00006150| 72 67 32 29 3b 0d 09 7d | 0d 20 20 20 20 20 20 73 |rg2);..}|. s|
|00006160| 65 74 5f 66 6c 6f 61 74 | 5f 68 61 6e 64 6c 65 72 |et_float|_handler|
|00006170| 20 28 63 6f 6d 62 69 6e | 65 5f 65 72 72 6f 72 29 | (combin|e_error)|
|00006180| 3b 0d 0d 23 69 66 64 65 | 66 20 52 45 41 4c 5f 41 |;..#ifde|f REAL_A|
|00006190| 52 49 54 48 4d 45 54 49 | 43 0d 20 20 20 20 20 20 |RITHMETI|C. |
|000061a0| 52 45 41 4c 5f 41 52 49 | 54 48 4d 45 54 49 43 20 |REAL_ARI|THMETIC |
|000061b0| 28 76 61 6c 75 65 2c 20 | 63 6f 64 65 2c 20 64 31 |(value, |code, d1|
|000061c0| 2c 20 64 32 29 3b 0d 23 | 65 6c 73 65 0d 20 20 20 |, d2);.#|else. |
|000061d0| 20 20 20 73 77 69 74 63 | 68 20 28 63 6f 64 65 29 | switc|h (code)|
|000061e0| 0d 09 7b 0d 09 63 61 73 | 65 20 50 4c 55 53 5f 45 |..{..cas|e PLUS_E|
|000061f0| 58 50 52 3a 0d 09 20 20 | 76 61 6c 75 65 20 3d 20 |XPR:.. |value = |
|00006200| 64 31 20 2b 20 64 32 3b | 0d 09 20 20 62 72 65 61 |d1 + d2;|.. brea|
|00006210| 6b 3b 0d 0d 09 63 61 73 | 65 20 4d 49 4e 55 53 5f |k;...cas|e MINUS_|
|00006220| 45 58 50 52 3a 0d 09 20 | 20 76 61 6c 75 65 20 3d |EXPR:.. | value =|
|00006230| 20 64 31 20 2d 20 64 32 | 3b 0d 09 20 20 62 72 65 | d1 - d2|;.. bre|
|00006240| 61 6b 3b 0d 0d 09 63 61 | 73 65 20 4d 55 4c 54 5f |ak;...ca|se MULT_|
|00006250| 45 58 50 52 3a 0d 09 20 | 20 76 61 6c 75 65 20 3d |EXPR:.. | value =|
|00006260| 20 64 31 20 2a 20 64 32 | 3b 0d 09 20 20 62 72 65 | d1 * d2|;.. bre|
|00006270| 61 6b 3b 0d 0d 09 63 61 | 73 65 20 52 44 49 56 5f |ak;...ca|se RDIV_|
|00006280| 45 58 50 52 3a 0d 09 20 | 20 69 66 20 28 64 32 20 |EXPR:.. | if (d2 |
|00006290| 3d 3d 20 30 29 0d 09 20 | 20 20 20 61 62 6f 72 74 |== 0).. | abort|
|000062a0| 20 28 29 3b 0d 0d 09 20 | 20 76 61 6c 75 65 20 3d | ();... | value =|
|000062b0| 20 64 31 20 2f 20 64 32 | 3b 0d 09 20 20 62 72 65 | d1 / d2|;.. bre|
|000062c0| 61 6b 3b 0d 0d 09 63 61 | 73 65 20 4d 49 4e 5f 45 |ak;...ca|se MIN_E|
|000062d0| 58 50 52 3a 0d 09 20 20 | 76 61 6c 75 65 20 3d 20 |XPR:.. |value = |
|000062e0| 64 31 20 3c 20 64 32 20 | 3f 20 64 31 20 3a 20 64 |d1 < d2 |? d1 : d|
|000062f0| 32 3b 0d 09 20 20 62 72 | 65 61 6b 3b 0d 0d 09 63 |2;.. br|eak;...c|
|00006300| 61 73 65 20 4d 41 58 5f | 45 58 50 52 3a 0d 09 20 |ase MAX_|EXPR:.. |
|00006310| 20 76 61 6c 75 65 20 3d | 20 64 31 20 3e 20 64 32 | value =| d1 > d2|
|00006320| 20 3f 20 64 31 20 3a 20 | 64 32 3b 0d 09 20 20 62 | ? d1 : |d2;.. b|
|00006330| 72 65 61 6b 3b 0d 0d 09 | 64 65 66 61 75 6c 74 3a |reak;...|default:|
|00006340| 0d 09 20 20 61 62 6f 72 | 74 20 28 29 3b 0d 09 7d |.. abor|t ();..}|
|00006350| 0d 23 65 6e 64 69 66 20 | 2f 2a 20 6e 6f 20 52 45 |.#endif |/* no RE|
|00006360| 41 4c 5f 41 52 49 54 48 | 4d 45 54 49 43 20 2a 2f |AL_ARITH|METIC */|
|00006370| 0d 20 20 20 20 20 20 73 | 65 74 5f 66 6c 6f 61 74 |. s|et_float|
|00006380| 5f 68 61 6e 64 6c 65 72 | 20 28 30 29 3b 0d 20 20 |_handler| (0);. |
|00006390| 20 20 20 20 72 65 74 75 | 72 6e 20 62 75 69 6c 64 | retu|rn build|
|000063a0| 5f 72 65 61 6c 20 28 54 | 52 45 45 5f 54 59 50 45 |_real (T|REE_TYPE|
|000063b0| 20 28 61 72 67 31 29 2c | 20 76 61 6c 75 65 29 3b | (arg1),| value);|
|000063c0| 0d 20 20 20 20 7d 0d 23 | 65 6e 64 69 66 20 2f 2a |. }.#|endif /*|
|000063d0| 20 6e 6f 74 20 52 45 41 | 4c 5f 49 53 5f 4e 4f 54 | not REA|L_IS_NOT|
|000063e0| 5f 44 4f 55 42 4c 45 2c | 20 6f 72 20 52 45 41 4c |_DOUBLE,| or REAL|
|000063f0| 5f 41 52 49 54 48 4d 45 | 54 49 43 20 2a 2f 0d 20 |_ARITHME|TIC */. |
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.